Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim matchadd命令不适用于多个选项卡 hi CustomYellow ctermbg=205 guibg=yellow guifg=black ctermfg=black 调用matchadd('CustomYellow','\')) hi CustomCyan ctermbg=205 guibg=Cyan guifg=black ctermfg=black 调用matchadd('CustomCyan','\') hi CustomGray ctermbg=205 guibg=Gray guifg=black ctermfg=black 调用matchadd('CustomGray','\'))_Vim_Tabs_Highlight - Fatal编程技术网

Vim matchadd命令不适用于多个选项卡 hi CustomYellow ctermbg=205 guibg=yellow guifg=black ctermfg=black 调用matchadd('CustomYellow','\')) hi CustomCyan ctermbg=205 guibg=Cyan guifg=black ctermfg=black 调用matchadd('CustomCyan','\') hi CustomGray ctermbg=205 guibg=Gray guifg=black ctermfg=black 调用matchadd('CustomGray','\'))

Vim matchadd命令不适用于多个选项卡 hi CustomYellow ctermbg=205 guibg=yellow guifg=black ctermfg=black 调用matchadd('CustomYellow','\')) hi CustomCyan ctermbg=205 guibg=Cyan guifg=black ctermfg=black 调用matchadd('CustomCyan','\') hi CustomGray ctermbg=205 guibg=Gray guifg=black ctermfg=black 调用matchadd('CustomGray','\')),vim,tabs,highlight,Vim,Tabs,Highlight,这些是用于在vimrc文件中设置自定义字高亮显示的行。 当我在不同的Vim窗口中打开不同的文件时,突出显示正常工作,但如果我使用选项卡在同一Vim窗口中打开不同的文件,突出显示将停止工作。matchadd(),如:match,仅适用于当前窗口。:split和:tab split会创建一个新窗口,并且不会突出显示匹配项。您需要为每个新窗口重新执行匹配定义 :autocmd WinEnter允许您在每次输入窗口时执行代码。为了避免在重新访问窗口时定义其他相同的匹配项,您可以使用静态{id},并在:s

这些是用于在vimrc文件中设置自定义字高亮显示的行。 当我在不同的Vim窗口中打开不同的文件时,突出显示正常工作,但如果我使用选项卡在同一Vim窗口中打开不同的文件,突出显示将停止工作。

matchadd()
,如
:match
,仅适用于当前窗口。
:split
:tab split
会创建一个新窗口,并且不会突出显示匹配项。您需要为每个新窗口重新执行匹配定义

:autocmd WinEnter
允许您在每次输入窗口时执行代码。为了避免在重新访问窗口时定义其他相同的匹配项,您可以使用静态
{id}
,并在
:silent!中已经存在错误时抑制该错误

 hi CustomYellow ctermbg=205 guibg=yellow guifg=black ctermfg=black
call matchadd('CustomYellow', '\<TODO\>')
hi CustomCyan ctermbg=205 guibg=Cyan guifg=black ctermfg=black
call matchadd('CustomCyan', '\<DEBUG\>')
hi CustomGray ctermbg=205 guibg=Gray guifg=black ctermfg=black
call matchadd('CustomGray', '\<TEMP\>')
autocmd WinEnter*静音!调用matchadd('CustomYellow','\',10,12345)

matchadd()
仅适用于当前窗口,因此如果您希望它们应用于多个窗口,则需要重新执行。是否有任何方法可以自动重新执行此操作?将其放入(Buf)WinEnter自动命令中,或者制作一个插件。请根据我发布的代码给我一个示例?
autocmd WinEnter * silent! call matchadd('CustomYellow', '\<TODO\>', 10, 12345)