how to ignore bracket in C/C++ comment for matching

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to ignore bracket in C/C++ comment for matching

Hans-5
Hello,

        When I use "%" to find the matching bracket,
Vim leads me to the bracket in some commented line.
Can I tell Vim to ignore the bracket in comment?
        This problem also exists in auto-indention.

        My VIM is GVIM (Win32) V6.3, compiled by
Bram@KIBAALE, on Jun 7 2004.

Yorkwar

Reply | Threaded
Open this post in threaded view
|

Re: how to ignore bracket in C/C++ comment for matching

A.J.Mechelynck
----- Original Message -----
From: "Hans" <[hidden email]>
To: "vim" <[hidden email]>
Sent: Thursday, September 08, 2005 3:55 AM
Subject: how to ignore bracket in C/C++ comment for matching


> Hello,
>
> When I use "%" to find the matching bracket,
> Vim leads me to the bracket in some commented line.
> Can I tell Vim to ignore the bracket in comment?
> This problem also exists in auto-indention.
>
> My VIM is GVIM (Win32) V6.3, compiled by
> Bram@KIBAALE, on Jun 7 2004.
>
> Yorkwar

That's gvim 6.3.000. 86 bugfixes have been published since then. I suggest
that you install them. Vim 6.3.086 for Windows is available from links on
the following web pages:

http://users.skynet.be/antoine.mechelynck/vim/#ajm
- one zipfile containing only the executables (vim, vimd, gvim, gvimd) and
the Russian message translations. Install at least one executable; it is
possible to install all four. g- in the name means "with GUI (and, here,
also with OLE)"; -d means "compiled with debugging information".
- another zipfile (optional) with the runtime files as of 2005-07-20.
    These archives are meant to be unzipped over a working (but possibly
out-of-date) 6.3 installation.

http://cream.sourceforge.net/vim.html
- a self-installer for full 6.3.086 installation (gvim only) including
runtime files as of 2005-09-06. [Scroll down to "Experimental" to find the
link.]
    This is a full, self-contained installation.

See also
    :help %
    :help 'cpoptions'
    :help matchit-install

The matchit plugin implements extended % matching, which might solve your
problem. Notes:
    1. the directory for user-private runtime files on Windows is
~/vimfiles, not ~/.vim .
    2. If you have write access to $VIM (i.e., usually C:\Program Files\vim)
I recommend to install matchit into $VIM/vimfiles (the system-wide runtime
directory) rather than into ~/vimfiles (the user-private runtime directory).


HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: how to ignore bracket in C/C++ comment for matching

Hans-5
In reply to this post by Hans-5
It works.

When I installed the plugin matchit, and set "let b:match_words=&matchpairs",
I get what I want.

Thanks
----- Original Message -----
From: "Yorkwar" < [hidden email]>
To: "vim" < [hidden email]>
Sent: Thursday, September 08, 2005 3:55 AM
Subject: how to ignore bracket in C/C++ comment for matching


>  Hello,
>
>  When I use "%" to find the matching bracket,
>  Vim leads me to the bracket in some commented line.
>  Can I tell Vim to ignore the bracket in comment?
>  This problem also exists in auto-indention.
>
>  My VIM is GVIM (Win32) V6.3, compiled by
>  Bram@KIBAALE, on Jun 7 2004.
>
>  Yorkwar

That's gvim 6.3.000. 86 bugfixes have been published since then. I suggest
that you install them. Vim 6.3.086 for Windows is available from links on
the following web pages:

http://users.skynet.be/antoine.mechelynck/vim/#ajm
- one zipfile containing only the executables (vim, vimd, gvim, gvimd) and
the Russian message translations. Install at least one executable; it is
possible to install all four. g- in the name means "with GUI (and, here,
also with OLE)"; -d means "compiled with debugging information".
- another zipfile (optional) with the runtime files as of 2005-07-20.
    These archives are meant to be unzipped over a working (but possibly
out-of-date) 6.3 installation.

http://cream.sourceforge.net/vim.html
- a self-installer for full 6.3.086 installation (gvim only) including
runtime files as of 2005-09-06. [Scroll down to "Experimental" to find the
link.]
    This is a full, self-contained installation.

See also
    :help %
    :help 'cpoptions'
    :help matchit-install

The matchit plugin implements extended % matching, which might solve your
problem. Notes:
    1. the directory for user-private runtime files on Windows is
~/vimfiles, not ~/.vim .
    2. If you have write access to $VIM (i.e., usually C:\Program Files\vim)
I recommend to install matchit into $VIM/vimfiles (the system-wide runtime
directory) rather than into ~/vimfiles (the user-private runtime directory).


HTH,
Tony.