【问题标题】:Vim: Changing colorscheme in normal modeVim:在正常模式下更改颜色方案
【发布时间】:2015-06-10 00:22:40
【问题描述】:

当我处于正常模式/可视模式时,我希望有不同的配色方案,并在我处于插入模式时切换到我的默认配色方案。可能吗 ?

【问题讨论】:

标签: vim configuration-files mode color-scheme typing


【解决方案1】:

除了覆盖(内置)命令,您还可以挂钩到 InsertEnter / InsertLeave 自动命令:

autocmd InsertLeave * highlight Normal guibg=grey8
autocmd InsertEnter * highlight Normal guibg=black

这还将涵盖更改模式的自定义(插件)映射,并避免重新映射<Esc>,这可能会出现问题。

【讨论】:

    【解决方案2】:

    谢谢,但这是状态行。我在我的 vimrc 中找到了这样的解决方案:

    noremap i :highlight Normal guibg=grey8<cr>i
    noremap o :highlight Normal guibg=grey8<cr>o
    noremap s :highlight Normal guibg=grey8<cr>s
    noremap a :highlight Normal guibg=grey8<cr>a
    noremap I :highlight Normal guibg=grey8<cr>I
    noremap O :highlight Normal guibg=grey8<cr>O
    noremap S :highlight Normal guibg=grey8<cr>S
    noremap A :highlight Normal guibg=grey8<cr>A
    
    "You need the next line to change the color back when you hit escape.
    inoremap <Esc> <Esc>:highlight Normal guibg=black<cr> 
    

    【讨论】:

      猜你喜欢
      • 2012-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-18
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      • 2019-08-22
      相关资源
      最近更新 更多