Setting the Vim Background Colors

Setting the Vim background colors

As vim's own help on set background says, "Setting this option does not change the background color, it tells Vim what the background color looks like. For changing the background color, see |:hi-normal|."

For example

:highlight Normal ctermfg=grey ctermbg=darkblue

will write in white on blue on your color terminal.

Changing background colors

As it turns out the big blue section is controlled by highlight NonText

I added my .vimrc file to this:

highlight NonText ctermfg=59 ctermbg=0 cterm=NONE guifg=#414e58 guibg=#232c31 gui=NONE

and that gave me exactly what I wanted.

Can vim's background color be changed based on the current mode?

check autocmd

http://vimdoc.sourceforge.net/htmldoc/autocmd.html

for vim 8

:autocmd InsertEnter * set bg=light
:autocmd InsertLeave * set bg=dark

for vim version 9.0 please check

https://yianwillis.github.io/vimcdoc/doc/autocmd.html#ModeChanged

For the example in the site, you can change to relative numbering when enter visual mode

:au ModeChanged [vV\x16]*:* let &l:rnu = mode() =~# '^[vV\x16]'
:au ModeChanged *:[vV\x16]* let &l:rnu = mode() =~# '^[vV\x16]'
:au WinEnter,WinLeave * let &l:rnu = mode() =~# '^[vV\x16]'

force vim background to black


 colorscheme wombat256
highlight Normal guibg=black guifg=white
set background=dark

Tweak to taste :)

@edit: after reading you later comment I suspect you'll find you need to override more related highlight (group) background colors. It'll be clearest which ones, by reading the existing color schemes



Related Topics



Leave a reply



Submit