Jürgen Krämer wrote: >Suresh Govindachar wrote: >> A.J.Mechelynck wrote >>>Suresh Govindachar wrote: >>>> >>>> Start gvim via command: >>>> c:\opt\vim\vim70\gvim.exe --noplugin -u NONE -U NONE >>>> >>>> :saveas boo.c >>>> :set filetype=c >>>> >>>> Enter following text: >>>> >>>> if(1) >>>> { >>>> /* ------- {{{3 */ >>>> } >>>> >>>> :w >>>> 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. > > 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-%"). 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. > The text > > Does not recognize "/*" and "*/". > > from this help section does not relate to /* and */ as C style comments, > but as potentially matching pairs which are not counted as such if % is > included in cpoptions. > > 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.
After adding :set cpo-=% to the steps given in OP to reproduce the bug, one sees that there is a bug in Vim. --Suresh