Ed S. Peschko wrote:
> ps -
>
> where exactly are the b:match_words variables defined for a given language?
>
> I would have thought it would be as easy as saying:
>
> :source $VIMRUNTIME/macros/matchit.vim
>
> to get the correct b:match_words variable for my current extension being
> edited,
> but this doesn't work.
>
> Is there a plugin with the b:match_words variables defined for all languages,
> or
> am I just missing something?
>
> Ed
>
>
> On Sun, Sep 23, 2007 at 03:49:06PM -0700, Ed S. Peschko wrote:
>> All,
>>
>> I've been editing html files as of late, and have run into some usability
>> snags.
>>
>> In particular - what's the rationale behind having syntax coloring turned on
>> for
>> a given file, yet 'matchit' turned off?
>>
>> IMO, This makes no sense - you need to bounce between tags to get anything
>> done with
>> html (likewise all non-bracketed languages like python and ruby ) *far* more
>> than you
>> need to see code highlighted, and it is a non-trivial operation to get it
>> configured
>> to do the shift-% trick (still going through the docs and figuring it out)
>>
>> Could vim possibly be configured in the next release to do the intelligent
>> thing via
>> default and to pick up the appropriate matchit commands per file extension,
>> unless
>> overriden by another flag?
>>
>> Or is there something preventing this from happening? It sure would make the
>> job
>> of editing these files a lot easier..
>>
>> Ed
1. Matchit is non-vi-compatible, that's why it isn't installed by default.
Installing it is a simple matter. You can even make it work for all future
releases of Vim and matchit in one fell swoop, by creating a file named
$VIM/vimfiles/plugin/matchit.vim with the following contents:
runtime! macros/matchit.vim
You will still have to copy the matchit help (when it changes) to your
$VIM/vimfiles/doc/ subdirectory and run ":helptags" there.
2. Most "modern" ftplugins set b:match_words as a matter of course, at least
if they can detect that matchit is installed: it works flawlessly for me in
HTML. Of course it requires filetype plugins to be ON: include either
runtime vimrc_example.vim
or
filetype plugin on
somewhere near the top of your vimrc (but after the ":language" command if you
use one).
For some languages, there are no special "words" to be matched: there you can
get the additional matchit functionality (such as comment skipping) by means
of some autocommand similar to the following, which I have in my vimrc:
augroup vimrclocal
au FileType c,cpp,css,javascript
\ let b:match_words = &matchpairs
augroup END
Best regards,
Tony.
--
Eisenhower was very nice,
Nixon was his only vice.
-- C. Degen
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---