gpt4 book ai didi

c++ - 如何在 GVim 中禁用高亮括号

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:05:25 25 4
gpt4 key购买 nike

我试图通过 GVim 在 C++ 中突出显示我自己的类名和函数名。我阅读并关注了 link来自计算器。也请查看结果 link

我在语法目录下的 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

---------------------------- EOF -------------------- ----------

enter image description here

最佳答案

你应该编辑你的 .vimrc 文件。只需将这一行添加到文件中:

let g:loaded_matchparen= 1

关于c++ - 如何在 GVim 中禁用高亮括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6533015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com