我正在尝试通过GVim突出显示C ++中我的类名和函数名。
我阅读并按照了stack overflow上的link,请还要查看结果link。
我将以下设置复制到了位于语法目录下的cpp.vim文件中。
它起作用了,但将我的括号用红色标出来。我如何禁用括号的高亮显示? 我删除了.vimrc文件并重新打开我的cpp文件,结果还是一样的。所以我认为这是上面代码的问题。
-------------------- 已解决 [解决方案] --------------------
我将以下设置复制到了位于语法目录下的cpp.vim文件中。
" Highlight Class and Function names
syn match cCustomParen "(" contains=cParen,cCppParen
syn match cCustomFunc "\w\+\s*(" contains=cCustomParen
syn match cCustomScope "::"
syn match cCustomClass "\w\+\s*::" contains=cCustomScope
hi def link cCustomFunc Function
hi def link cCustomClass Function
它起作用了,但将我的括号用红色标出来。我如何禁用括号的高亮显示? 我删除了.vimrc文件并重新打开我的cpp文件,结果还是一样的。所以我认为这是上面代码的问题。
-------------------- 已解决 [解决方案] --------------------
syn match customFunc "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
syn match customFunc "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi def customFunc gui=NONE guifg=#E54023
syn match cCustomScope "::"
syn match cCustomClass "\w\+\s*::" contains=cCustomScope
hi def link cCustomClass Function
--------------------------- 文件结束 ------------------------------
syn match cCustomFunc "\w\+\s*(" contains=cCustomParen
- Marco