If you use vi/vim text editor in a terminal with a dark background it may be hard to read some text due to improperly configured color scheme.
For example, dark-blue comments on a black background in vi/vim make them almost unreadable.
By default, vi/vim is configured to work with a light background, i.e. has a set background=light setting.
If you use the dark background in your terminal, you need to change the background setting in vi/vim, that will lead to adjustment of a color scheme to the dark background and make the text readable.
This short note shows how to fix colors on the dark background in vi/vim.
Cool Tip: Fix not working backspace in vi/vim! Read more →
Fix Colors on Dark Background in Vi/Vim
To fix the colors on the dark background in vi/vim, execute:
:set background=dark
To set the dark background permanently, add the following line to your $HOME/.vimrc file:
set background=dark
Once the set background=dark is applied, vi/vim should adjust the color scheme accordingly, that will make the text on the dark background readable.
Cool Tip: Fix “not working” arrow keys in vi/vim! Read more →