On 23/10/08 23:11, Robin Wood wrote:
> 2008/10/23 Tony Mechelynck<[EMAIL PROTECTED]>:
>> On 23/10/08 10:36, Robin Wood wrote:
>>> 2008/10/22 Tony Mechelynck<[EMAIL PROTECTED]>:
>>>> Matchit is not "breaking" anything, it "improves" % matching; however,
>>>> to do that, it relies on a buffer-local variable b:match_words telling
>>>> it what to match: just look up what that variable is set to in:
>>>> - a Vim script,
>>>> - an HTML file,
>>>> - an XML file
>>>> - a bash script
>>>> - etc.
>>>>
>>>> The above autocommand "restores" matching of round, square and curly
>>>> brackets for these 4 filetypes which don't set the matchit setting in
>>>> their filetype-plugins. However even here there is a plus: with the
>>>> above, and matchit loaded at startup, you won't anymore pair a bracket
>>>> within a comment with its opposite outside a comment.
>>>>
>>> if has('autocmd')
>>> augroup vimrclocal
>>> " match (:),[:],{:} in matchit for C, C++, CSS and javascript
>>> au FileType c,cpp,css,javascript,php
>>> \ let b:match_words =&matchpairs
>>> " you may have other autocommands, unrelated to the above.
>>> " Place them here.
>>> augroup END
>>> endif
>>>
>>> I mainly edit .html and .php files so I added php to the FileType list
>>> when adding this to my .vimrc. After this normal bracket matching
>>> works for .php files but I lose the html matching, html matching
>>> works fine on .html files but no bracket matching.
>>>
>>> How do I view the buffer? I'll send in the entries from the different
>>> file types.
>> What do you mean by "view the buffer"? The file you're editing is in the
>> active window. If you mean the autocommands for the FileType event,
>>
>> :verbose au FileType
>>
>> will show them. You can optionally add an autocommand group name before
>> the event name and/or an autocommand pattern after it. If you mean the
>> b:match_words variable or the 'matchpairs' options for the current
>> buffer, display them (after making sure that you edit the right buffer)
>> by means of
>>
>> :echo b:match_words
>> :verbose set matchpairs?
>
> OK, from this, when editing a php file I get
> :echo b:match_words
> (:),{:},[:]
>
> and :verbose set matchpairs? gives
> matchpairs=(:),{:},[:]
>
> However, on my desktop with the latest vim when I do the echo I get this
>
> <?php:?>,\<switch\>:\<endswitch\>,\<if\>:\<elseif\>:\<else\>:\<endif\>,\<while\>:\<endwhile\>,\<do\>:\<while\>,\<for\>:\<endfor\>,\<foreach\>:\<endforeach\>,(:),[:],{:},<:>,<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/
> [ou]l>,<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,<\@<=\([^/][^
> \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>
>
> This obviously explains the difference in how things work. Could it be
> just the version of vim that is causing the problem or something else.
>
> About the version, I know it is old, I know it needs updating, I know
> there are bugs in it but I also know there is nothing I can do about
> it. It isn't getting upgraded which is why I would like a fix for
> this. If it isn't possible then as long as I know that it isn't I can
> live with it but not knowing is very frustrating. Every other machine
> I use has up-to-date versions, it is just this one machine.
>
> Robin
Have you got matchit installed? Look at the output of ":scriptnames" and
see if matchit is listed. If it isn't, then on Unix/Linux bash
#!bin/bash
cd ~
mkdir -pv .vim/plugin
cd .vim/plugin
echo 'source $VIMRUNTIME/macros/matchit.vim' > matchit.vim
mkdir -pv ../doc
cd ../doc
# if necessary, change the path below to reflect your $VIMRUNTIME
ln -sv /usr/local/share/vim/vim63/macros/matchit.txt
vim -es -c 'helptags ~/.vim/doc' -cq
But then, if your ftplugins are not setting b:match_words it means
you've got obsolete versions of the runtime files.
Best regards,
Tony.
--
Matter cannot be created or destroyed, nor can it be returned without a
receipt.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---