Hi François! On Mo, 05 Sep 2011, François Ingelrest wrote:
> Hi all, > > The following code is highlighted incorrectly when using the cpp filetype: > > #if defined FOO > #elif defined BAR > #endif > > The part "defined BAR" is not highlighted, while "defined FOO" is. > AFAICT, my runtime files are up to date. > > I don't know much about Vim syntax files, so I can't tell where > exactly is the problem. Hm, I think, the syn match takes precedence over the defined region there. If one makes the regular expression for the syn-match tighter, it should work. Something like this seems to work: chrisbra@R500 ~/local/share/vim/vim73/syntax % diff -u c.vim{,.new} --- c.vim 2011-09-05 10:23:24.074758311 +0200 +++ c.vim.new 2011-09-05 10:23:21.584754659 +0200 @@ -273,7 +273,7 @@ " Accept %: for # (C99) syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError -syn match cPreConditMatch display "^\s*\(%:\|#\)\s*\(else\|endif\|elif\)\>" +syn match cPreConditMatch display "^\s*\(%:\|#\)\s*\(else\|endif\|elif\)\>$" if !exists("c_no_if0") syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip syn region cCppOutWrapper start="^\s*\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse fold But Bram knows best, whether this is right. regards, Christian -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php