【发布时间】:2015-06-10 00:22:40
【问题描述】:
当我处于正常模式/可视模式时,我希望有不同的配色方案,并在我处于插入模式时切换到我的默认配色方案。可能吗 ?
【问题讨论】:
标签: vim configuration-files mode color-scheme typing
当我处于正常模式/可视模式时,我希望有不同的配色方案,并在我处于插入模式时切换到我的默认配色方案。可能吗 ?
【问题讨论】:
标签: vim configuration-files mode color-scheme typing
除了覆盖(内置)命令,您还可以挂钩到 InsertEnter / InsertLeave 自动命令:
autocmd InsertLeave * highlight Normal guibg=grey8
autocmd InsertEnter * highlight Normal guibg=black
这还将涵盖更改模式的自定义(插件)映射,并避免重新映射<Esc>,这可能会出现问题。
【讨论】:
谢谢,但这是状态行。我在我的 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>
【讨论】: