Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim Configure Line Number Coloring

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.

like image 440
Daniel Spiewak Avatar asked Oct 26 '08 00:10

Daniel Spiewak


People also ask

How do I highlight line numbers in vim?

Valid values: "line" Highlight the text line of the cursor with CursorLine hl-CursorLine. "screenline" Highlight only the screen line of the cursor with CursorLine hl-CursorLine. "number" Highlight the line number of the cursor with CursorLineNr hl-CursorLineNr. Thanks.

How do I change the color of a line in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.


1 Answers

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 
like image 164
Greg Hewgill Avatar answered Sep 28 '22 04:09

Greg Hewgill