使用vim或nvim,当我打开一个新的 vim 终端时,有向图正确显示。见下文:
然而,每当我改变colorscheme
(任何,它不是特定于特定的配色方案) - 然后有向图就会突出显示。即使切换回原始配色方案,突出显示仍然存在。任何有向图都会发生这种情况,而不仅仅是这个问题中显示的那个。见下文:
无法找到删除该突出显示的方法,或首先阻止它发生。尝试过类似的命令,:highlight nonascii none
但没有运气。非常感谢任何帮助/建议。
大多数/某些配色方案并不是真正为热插拔而设计的。日晒fe似乎是一个相当普遍的问题
有一个插件可以干净地处理更改:https ://github.com/xolox/vim-colorscheme-switcher (我还没有测试过)。
我在某个地方复制了一堆函数,这些函数在大多数情况下都可以解决这些问题。我不知道我从哪里得到的,但我想澄清一下,这不是我的工作!
function! s:Find_links() " {{{1
" Find and remember links between highlighting groups.
redir => listing
try
silent highlight
finally
redir END
endtry
for line in split(listing, "\n")
let tokens = split(line)
" We're looking for lines like "String xxx links to Constant" in the
" output of the :highlight command.
if len(tokens) == 5 && tokens[1] == 'xxx' && tokens[2] == 'links' && tokens[3] == 'to'
let fromgroup = tokens[0]
let togroup = tokens[4]
let s:known_links[fromgroup] = togroup
endif
endfor
endfunction
function! s:Restore_links() " {{{1
" Restore broken links between highlighting groups.
redir => listing
try
silent highlight
finally
redir END
endtry
let num_restored = 0
for line in split(listing, "\n")
let tokens = split(line)
" We're looking for lines like "String xxx cleared" in the
" output of the :highlight command.
if len(tokens) == 3 && tokens[1] == 'xxx' && tokens[2] == 'cleared'
let fromgroup = tokens[0]
let togroup = get(s:known_links, fromgroup, '')
if !empty(togroup)
execute 'hi link' fromgroup togroup
let num_restored += 1
endif
endif
endfor
endfunction
function! s:AccurateColorscheme(colo_name)
call <SID>Find_links()
exec "colorscheme " a:colo_name
call <SID>Restore_links()
endfunction
command! -nargs=1 -complete=color MyColorscheme call <SID>AccurateColorscheme(<q-args>)