VIM中的颜色高亮显示函数调用

VIM中的颜色高亮显示函数调用,vim,syntax-highlighting,vim-plugin,vim-syntax-highlighting,Vim,Syntax Highlighting,Vim Plugin,Vim Syntax Highlighting,有人知道在Vim中高亮显示函数调用的方法吗 我知道一些插件可以通过记录标签来做类似的事情,但是根据我在网上找到的,我无法弄清楚如何使它工作 我尝试过使用(顺便说一句,它似乎不再被维护)并且,说实话,我还没有接近于让它们工作 另一方面,我认为实现一个脚本来突出显示位于点和左括号或空格和左括号之间的任何内容(如.anyCodeAtAll(),anotherCode()),将非常简单,但我不知道如何做。当然,这是一个不完整的解决方案,但就我目前的目的而言,这已经足够好了 有人知道如何实现这一点吗?我的

有人知道在Vim中高亮显示函数调用的方法吗

我知道一些插件可以通过记录标签来做类似的事情,但是根据我在网上找到的,我无法弄清楚如何使它工作

我尝试过使用(顺便说一句,它似乎不再被维护)并且,说实话,我还没有接近于让它们工作

另一方面,我认为实现一个脚本来突出显示位于点和左括号或空格和左括号之间的任何内容(如
.anyCodeAtAll()
anotherCode()
),将非常简单,但我不知道如何做。当然,这是一个不完整的解决方案,但就我目前的目的而言,这已经足够好了


有人知道如何实现这一点吗?

我的配置中有类似的功能,但它非常特定于语言。例如,对于Golang,我有一个
~/.vim/after/go.vim
,其中包含:

syntax match goCustomParen     "(" contains=cParen
syntax match goCustomFuncDef   "func\s\+\w\+\s*(" contains=goDeclaration,goCustomParen
" Exclude import as function name, for multi-line imports
syntax match goCustomFunc      "import\s\+(\|\(\w\+\s*\)(" contains=goCustomParen,goImport
syntax match goCustomScope     "\."
syntax match goCustomAttribute "\.\w\+" contains=goCustomScope
syntax match goCustomMethod    "\.\w\+\s*(" contains=goCustomScope,goCustomParen

highlight def link goCustomMethod Function
highlight def link goCustomAttribute Identifier

highlight goCustomFuncDef ctermfg=13
highlight goCustomFunc ctermfg=43
highlight goCustomAttribute ctermfg=247
highlight goCustomMethod ctermfg=33
对于Python,我有一个
~/.vim/after/Python.vim

syntax match pyCustomParen     "(" contains=cParen
syntax match pyCustomFunc      "\w\+\s*(" contains=pyCustomParen
syntax match pyCustomScope     "\."
syntax match pyCustomAttribute "\.\w\+" contains=pyCustomScope
syntax match pyCustomMethod    "\.\w\+\s*(" contains=pyCustomScope,pyCustomParen

highlight def link pyCustomFunc  Function
highlight def link pyCustomMethod Function
highlight def link pyCustomAttribute Identifier

highlight pyCustomFunc ctermfg=43
highlight pyCustomAttribute ctermfg=247
highlight pyCustomMethod ctermfg=33
在每种情况下,第一个块定义什么是函数、方法、属性等,第二个块将这些自定义定义链接到通用类“函数、标识符…”,第三个块定义颜色

文件需要位于
after
目录中,以便在colorscheme和突出显示定义之后执行

下面是有无这些设置的并列比较(查看最后3行):


除非有人有更好的解决方案,否则您可以根据所需的语言对上述内容进行调整。

可能是因为您没有正确安装插件。
尝试执行以下步骤(或回顾您的步骤)并查看是否有效/遗漏了任何步骤:

cd~
转到主目录。
vim.vimrc
open.vimrc
插入:

call plug#begin()  
Plug 'xolox/vim-easytags'  
call plug#end()
州easytags应该是开箱即用的,但是您可以在
.vimrc
文件现在或以后,
e、 g.投入:
让g:easytags\u syntax\u关键字='always'

在呼叫插头块之后。 无论如何。
:wq
写入并退出.vimrc

source~/.vimrc
不确定是否需要,稍后会这样做
vim test.js
用test.js打开vim,不管你知道什么语言。
:在vim中插入安装

这里可能需要一些时间。
然后
:q
跳出该窗口。
:source~/.vimrc
这是必需的

然后进行测试,看看是否有语法高亮显示。
我很确定这是正确的。可能是插件名称拼错了。

您看过插件名称了吗?如果有的话,你正在使用什么插件管理器?我正在使用插件。据我所知,Easy tags已成功安装。请看我的答案,我想放在这里,但格式问题出现了。太好了!谢谢你的帮助:如果答案对你有帮助,别忘了接受它;-)