Vim Configure Line Number Coloring

ConfigurationSyntax HighlightingVim

Configuration Problem Overview


I'm looking for a way to configure the color used for line numbering (as in: :set nu) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I would like to color the line numbers a dim gray; somewhere in the vicinity of #555. I'm not picky though, any subdued color would be acceptable.

Configuration Solutions


Solution 1 - Configuration

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

Solution 2 - Configuration

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.

Solution 3 - Configuration

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

hi CursorLineNr guifg=#050505

Solution 4 - Configuration

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDaniel SpiewakView Question on Stackoverflow
Solution 1 - ConfigurationGreg HewgillView Answer on Stackoverflow
Solution 2 - ConfigurationqasimalbaqaliView Answer on Stackoverflow
Solution 3 - ConfigurationRoshamboView Answer on Stackoverflow
Solution 4 - ConfigurationJabbaView Answer on Stackoverflow