配置行号着色

我正在寻找一种在 Vim 中配置用于行号(如: :set nu)的颜色的方法。大多数平台上的默认值似乎是黄色(也用于一些突出显示的令牌)。我将 喜欢把线号涂成暗灰色; 在 #555附近的某个地方。我不挑剔,任何柔和的颜色都可以接受。

84872 次浏览

Try:

help hl-LineNr

I found this through:

help 'number'

which is the way to get help on the 'number' option, instead of the :number command.

To actually change the displayed colour:

:highlight LineNr ctermfg=grey

This would change the foreground colour for LineNr on a character terminal to grey. If you are using gVim, you can:

:highlight LineNr guifg=#050505

In MacVim (with Vim 7.3 at it's core) I've found CursorLineNr to work:

hi CursorLineNr guifg=#050505

To change the line numbers permanently add the below to your .vimrc

highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE

Of course you change the ctermfg and guifg to whatever color you want.

I didn't like the colors provided by the selected color scheme so I modified the color of the line numbers this way:

colorscheme trivial256    " for light background
hi LineNr       term=bold cterm=bold ctermfg=2 guifg=Grey guibg=Grey90