如何删除vim中的有向图突出显示

时间:2018-01-11 12:27:22

标签: vim digraphs

使用 vim nvim ,当我正确打开新的vim终端digraphs时。见下文:

enter image description here

但是,每当我更改colorscheme(任何,它不是特定于特定颜色方案)时 - 然后突出显示有向图。即使切换回原始颜色方案,突出显示仍然存在。任何有向图都会发生这种情况,而不仅仅是这个问题中显示的有向图。 见下文:

enter image description here

找不到删除突出显示的方法,或者首先阻止它突然发生。尝试过像:highlight nonascii none这样的命令,但没有运气。任何帮助/建议非常感谢。

1 个答案:

答案 0 :(得分:0)

大部分/部分色彩方案并非真正适用于热交换。 solarized f.e。

似乎是一个相当普遍的问题

有一个插件可以干净地处理更改: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>)