Configuring vim for dark terminal windows

Terminal_background_light-darkOn CentOS, vim is installed with a default configuration. These defaults might be right for some users but not for everyone. I will describe the two settings I personally find most annoying for my setup.

One of the assumtions in the default settings of vim seems to be a light terminal window. The result of this assumption can be seen in the screenshot below.


The color scheme for the light terminal window uses dark blue to highlight comments. Dark blue on a black terminal window makes it nearly impossible to read. To change the color scheme, the following vim command can be used.

:set background=dark

With the above command, vim is informed that the terminal background is dark so the color scheme changes so it is readable.


This change in the color scheme is temporary. To make this permanent, the setting can be added to vim’s configuration file. It might be that this configuration file does not exist yet.

Open the vim config file ~/.vimrc and add the command as it was entered before (just without the colon at the beginning) into the file.

" Set the background to dark so the color scheme is changed to a better 
" readable one on dark terminal windows.
set background=dark

Lines starting with a double quote are comments. If you use vim to edit the file, these comments will be highlighted.

Save and close the file as usual using “:wq” (assuming you were editing it in vim). From now on, when opening a file with vim, the color scheme will be better readable on dark terminal windows.

Read more of my posts on my blog at

This entry was posted in Linux Administration and tagged . Bookmark the permalink.