VIM initial settings: change background color for line number on the left side?
Solution 1
highlight LineNr ctermfg=grey ctermbg=white
Solution 2
To make the line number column transparent (the same color as the main background) you can try setting this in your .vimrc
:
highlight clear LineNr
You can also clear the so-called sign column (used by gitgutter, etc) as well:
highlight clear SignColumn
This way, no matter what color scheme you use, both columns' background will be compatible.
Solution 3
In my _vimrc
, here is the setting:
highlight LineNr guibg=grey
or
hi LineNr guibg=grey
I don't need to set fore-color, the default is yellow and it is OK for me.
Solution 4
guibg and guifg are for vims which are not in terminal. For terminal you use ctermfg ctermbg. Usually in GUI vims you have more colors support and you simply want to avoid the background. So I usually use this:
highlight LineNr guibg=NONE
David.Chu.ca
Updated on December 17, 2020Comments
-
David.Chu.ca over 3 years
I use
_vimrc
to configure my vim 7.2 (windows) default settings. One setting "set number" will display line numbers on the left side. My vim background color is white (I cannot find setting for this. Maybe the default is white. Anyway I accept this setting).I would like the background color for line numbers to be Grey or dimmed color. What is the command I can put in my
_vimrc
to configure this default setting? -
adam_0 over 7 yearsThere's also
CursorLineNr
instead ofLineNr
for changing the highlight of the gutter of the line that you're currently on. -
sushpa about 7 years@adam_0 that's cool, turns out that
set cursorline
is needed as well for highlighting the line and wasn't on by default (at least for me; vim 7.4 on CentOS) -
sushpa about 7 yearsActually
set cursorline
seems meant for "highlighting the entire cursor line" but I seem to need it even to highlight just the gutter. -
sushpa about 7 yearsThose who use LightLine.vim can get a
CursorLineNr
highlight that reflects the current mode:hi! link CursorLineNr LightlineLeft_active_0
-
aderchox over 3 yearsthis doesn't seem to be useful if the main background is black.