Suresh Govindachar wrote:
> (snip)
> Enter following text:
>
>     if(1)
>     {
>       /* ------- {{{3 */
>     }
>
> Now try to jump between { using %. > Bug: The { in the manual fold-markers interferes with %-jumping.
>
> [comments on using the matchit plugin]
>
> % is a feature of Vim -- I am not trying to use % in any
> fancy way, only in the way it is supposed to work under
> regular Vim.  I am reporting a bug in vim (and not looking
> for a work-around based on a plugin).  The bug is that % is
> not ignoring { within c-comments in a c-file.

Jürgen Krämer wrote:
(snip)
> what did lead you to the conclusion that the behaviour of % -- to
> not ignore matching parentheses inside comments -- is a bug?
>
> In my past experience, % always ignored { inside c-comments
> for c-files (turns out my cpoptions does not include %).
> > I don't see a place in the help files where % is documented to
> skip comments. You can only force it to skip strings by removing
> % from cpoptions (see ":help cpo-%").

Suresh Govindachar wrote:
>    In the steps I gave to reproduce the bug, adding the following:
>         :set cpo-=%
>    does not make %-jumping skip the { inside comments.  So it is a
>    bug in Vim.

Jürgen Krämer wrote:
> IMHO ignoring comments while searching for a matching parenthesis might
> be considered a missing feature, but this can easily -- as Tony wrote --
> be implemented by sourcing the matchit plugin.

Suresh Govindachar wrote:
>  After adding :set cpo-=% to the steps given in OP to reproduce the bug,
>  one sees that there is a bug in Vim.
---------------------------------------------------------------------

Its not a bug. Vi compatible behavior governs this, with one exception: if a %
is missing from cpoptions, the %-brace matching will skip the innards of
strings.

Vim's documentation doesn't state anything about skipping braces/parentheses
inside of comments.  As Jürgen said, it may be nice to ask for a new feature
supporting the skipping of braces inside comments, especially in light of the default folding pattern. However, the documentation doesn't claim that % will skip over comments but rather that vi-compatible behavior will occur, hence the
behavior is not a bug.

Perhaps you should ask Bram for a '{' option in cpoptions to support this idea
for a new feature.

C Campbell

Reply via email to