配置文件—Vim:在正常模式下更改配色方案



我想有一个不同的配色方案,当我在正常模式/视觉模式和切换到我的默认配色方案,当我在我的插入模式。这可能吗?

除了覆盖(内置)命令,您还可以钩入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> 

最新更新