微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

颜色 – Vim CursorLine插入模式中的颜色变化

有更改光标颜色的好片段:
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)

原文地址:https://www.jb51.cc/vim/388405.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐