有更改光标颜色的好片段:
if &term =~ "xterm\\|rxvt" " use an orange cursor in insert mode let &t_SI = "\<Esc>]12;orange\x7" " use a red cursor otherwise let &t_EI = "\<Esc>]12;red\x7" silent !echo -ne "\033]12;red\007" " reset cursor when vim exits autocmd VimLeave * silent !echo -ne "\033]112\007" " use \003]12;gray\007 for gnome-terminal endif
我应该如何改变这个,而不是光标,CursorLine会改变颜色,例如从深蓝色到蓝色?
我的完整配置是https://bitbucket.org/JackLeo/home-configs/src/5b8faf340f87/.vimrc
您是否看到“高光”命令,这是一个更容易的方法来控制这个。
例如,要更改CursorLine,
:hi CursorLine guifg=red guibg=blue
参考::帮助高亮
使其在模式之间切换。
" Enable CursorLine set cursorline " Default Colors for CursorLine highlight CursorLine ctermbg=Yellow ctermfg=None " Change Color when entering Insert Mode autocmd InsertEnter * highlight CursorLine ctermbg=Green ctermfg=Red " Revert Color to default when leaving Insert Mode autocmd InsertLeave * highlight CursorLine ctermbg=Yellow ctermfg=None
我可能会将termcap颜色与autocmd混合使用,但是IMO的亮点更容易长期维护(如果偶尔使用gVim)