Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the Vim background colors

People also ask

How do I change the background color in Vim editor?

The ctermfg=white is used to set the foreground color to white in a terminal text editor. Finally, the ctermbg=black is used to set the background color to black in a terminal text editor.

How do I make my Vim background darker?

In Vim, if your color scheme supports both a light and dark mode, you switch between by using the command: set background=dark or set background=light . In Alacritty, you can define multiple color schemes and switch between them easily in the config file alacritty.

What is Ctermbg in Vim?

This highlight command can be read as “When using a color terminal (cterm), set the background terminal color (ctermbg) to Blue for the 'Normal' group.”


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.


In a terminal emulator like konsole or gnome-terminal, you should to set a 256 color setting for vim.

:set  t_Co=256

After that you can to change your background.


Try adding

set background=dark

to your .gvimrc too. This work well for me.


Using set bg=dark with a white background can produce nearly unreadable text in some syntax highlighting schemes. Instead, you can change the overall colorscheme to something that looks good in your terminal. The colorscheme file should set the background attribute for you appropriately. Also, for more information see:

:h color

supplement of windows

gvim version: 8.2

location of .gvimrc: %userprofile%/.gvimrc

" .gvimrc
colorscheme darkblue

Which color is allows me to choose?

Find your install directory and go to the directory of colors. in my case is: %PROGRAMFILES(X86)%\Vim\vim82\colors

blue.vim
darkblue.vim
slate.vim
...
README.txt