On 6/27/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Kamil Kisiel wrote: > I've started using foldmethod=marker for folding in my C++ source > files. Usually it works okay, but I find that several times a day the > syntax highlighting seems to get confused and start highlighting > braces after a particular fold in red, as if they did not have a > matching brace. This is never actually the case, and just doing an :e > <filename> again makes the problem go away for a while. It's > nevertheless an irritating issue and it just seems to occur at random. > Has anyone else had the same experience? Is there a fix? I'm using Vim > 7.0 on WinXP. >It might be due to how far back syntax highlighting scans the source. In that case, :syn sync fromstart might cure the problem, at the possible cost of some slowdown when opening a file for editing. The above sets the syntax sync method for the current file only. To apply it to all C/C++ sources opened in the future: :au Syntax c,cpp syn sync fromstart -- and either add the same to your vimrc or create a ~/vimfiles/after/syntax/c.vim with the line syn sync fromstart in it. (Create any needed files and/or folders that don't yet exist.) (Note: C syntax is invoked by the cpp syntax script.) Best regards, Tony.
Thanks Tony, that appears to have done the trick.
