On 10/02/09 12:32, Mahendra Ladhe wrote:
> Hi,
> when I use the '%' key to find matching brace('{' or '}') in a C program,
> vim includes the code which is commented out to find the matching brace.
> e.g.
>
> 1 #include <stdio.h>
> 2
> 3 int main(int argc, char* argv[])
> 4 {
> 5 int i=10;
> 6 /* } */
> 7 return 0;
> 8 }
>
> If the cursor is on line 4 under '{' and I press the '%' key, the cursor
> shows
> the matching closing brace on line 6 (which is commented out) and not
> the matching
> closing brace on line 8.
>
> Is there any workaround for this?
>
> Thanks,
> Mahendra
Install the matchit plugin, see ":help matchit-install". (It doesn't
match between inside and outside comments, and it can match much more
than single characters.) You may also, once you have installed it, add
au FileType c,cpp,css,javascript
\ let b:match_words = &matchpairs
to your vimrc, in order to use matchit for these file types instead of
default matching, but with the same matches. (The ftplugins for many
filetypes set matchit settings if the matchit plugin is found to have
been loaded.)
Best regards,
Tony.
--
INVENTORY
Four be the things I am wiser to know:
Idleness, sorrow, a friend, and a foe.
Four be the things I'd been better without:
Love, curiosity, freckles, and doubt.
Three be the things I shall never attain:
Envy, content, and sufficient champagne.
Three be the things I shall have till I die:
Laughter and hope and a sock in the eye.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---