设置Vim光标线颜色?

时间:2015-03-20 13:25:11

标签: vim

我试图在SO和Google上查看其他答案,但它们似乎都没有改变我的光标设置。我想要一个黄色的背景,白色粗体的前景,但不能用我在网络上看到的设置得到它。我在iTerm2中使用MacVim mvim。

感谢您的帮助。

enter image description here

2 个答案:

答案 0 :(得分:11)

您最有可能对这三个突出显示组感兴趣:CursorCursorColumnCursorLine。这些名字是不言自明的。

例如,只更改光标颜色:

:highlight Cursor ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold

对列光标执行相同的操作:

:highlight CursorColumn ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold

如果您还需要突出显示当前行,请使用CursorLine

答案 1 :(得分:4)

如果您想保持启用,请始终将以下内容放在.vimrc或.gvimrc文件中

for cursorline

set cursorline
autocmd InsertEnter * highlight CursorLine guibg=#000050 guifg=fg
autocmd InsertLeave * highlight CursorLine guibg=#004000 guifg=fg

表示游标列

set cursorcolumn
autocmd InsertEnter * highlight CursorColumn ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold
autocmd InsertLeave * highlight CursorColumn ctermfg=Black ctermbg=Yellow cterm=bold guifg=Black guibg=yellow gui=NONE

您可以更改愿望中的颜色