Bill McCarthy wrote:
> On Fri 24-Aug-07 2:16pm -0600, Tony Mechelynck wrote:
>
>> Bill McCarthy wrote:
>>> On Fri 24-Aug-07 12:03pm -0600, Tony Mechelynck wrote:
>>>> I just tried your example in 7.1.87 with matchit (and filetype set to cpp)
>>>> and
>>>> % jumped from the first to the third brace and
>>>> vice-versa, completely ignoring
>>>> the comment.
>
>>> Interesting - it does not work here with the latest
>>> matchit.vim (from macros) copied to my \vim\vimfiles\plugin\
>>> and :se ft=cpp
>>>
>>> The first '{' is highlighted when I'm on '}' but '%' jumps
>>> to the '{' in the C++ comment.
>
>> What is b:match_words set to in that buffer?
>
> It's not defined.
>
>> You might be interested in the following snippet from my vimrc:
>>
>> if has('autocmd')
>> augroup vimrclocal
>> au FileType c,cpp,css,javascript
>> \ let b:match_words = &matchpairs
>> augroup END
>> endif
>
> Incredible! The author went to the trouble of writing
> matchit and doesn't support C?
Matchit was written by Benji Fisher. Support for matchit in a given language
is the responsibility of the maintainer for that language's ftplugin -- for C,
Bram Moolenaar. For C, I suppose there wouldn't be much to gain from special
handling: #if #ifdef #ifndef #else #endif maybe, but what about the same with
one or more spaces immediately after the # ? And then maybe if else, but that
is already pretty much covered by { } I suppose.
For HTML (to mention a different language as an example), there are a lot of
multicharacter paired elements, and that plugin (by Dan Sharp) does support
matchit.
>
> Thanks for the tip. I've made this addition to my vimrc:
>
> autocmd FileType c let b:match_words = &matchpairs
>
> and now it actually works.
>
Best regards,
Tony.
--
Why is it that there are so many more horses' asses than there are
horses?
-- G. Gordon Liddy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---