设置 Vim 光标线颜色?
Setting Vim cursorline colors?
我试图在 SO 和 Google 上查看其他答案,但其中 none 似乎正在更改我的光标设置。我想要黄色背景和白色粗体前景,但无法通过我在网络上看到的设置获得它。我在 iTerm2 中使用 MacVim mvim。
感谢您的帮助。
您很可能对这三个突出显示组感兴趣:Cursor
、CursorColumn
和 CursorLine
。名称不言自明。
例如只改变光标颜色:
: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
。
如果你想保持启用,请始终将以下内容放入你的 .vimrc 或 .gvimrc 文件
对于光标线
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
颜色随心所欲
我试图在 SO 和 Google 上查看其他答案,但其中 none 似乎正在更改我的光标设置。我想要黄色背景和白色粗体前景,但无法通过我在网络上看到的设置获得它。我在 iTerm2 中使用 MacVim mvim。
感谢您的帮助。
您很可能对这三个突出显示组感兴趣:Cursor
、CursorColumn
和 CursorLine
。名称不言自明。
例如只改变光标颜色:
: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
。
如果你想保持启用,请始终将以下内容放入你的 .vimrc 或 .gvimrc 文件
对于光标线
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
颜色随心所欲