Do you use Vim in a black background Linux shell? Chances are you'll find the default colors for Vim or ls are hard to read, especially blue on black.

Tell Vim You are using a Dark Background

Configuring Vim is done by adding commands to the ~/.vimrc file. By default, Vim assumes you are using a white background. If you tell Vim you are using a dark background, it will display text with colors that are easier to see. Vim uses colors when it understands the syntax of the file you are editing, such as JavaScript. An example of this is shown in the first picture. Entering the following command in Vim will make the text more readable:

:set background=dark

To make this permanent just add the command to the end of ~/.vimrc and restart Vim. Your ~/.vimrc file might look like this for instance:

set background=dark tabstop=4

The other alternative is to just tell Vim not to interpret the syntax at all using the command:

set syntax=off

This results in a simple white on black screen, which works, but makes editing code a little more difficult.

Tell ls You are using a Dark Background

The ls command has a similar problem. Different file types and modes are colored differently. One default color is dark blue, which presents the same problem as editing files in Vim. The fix for this is setting the LS_COLORS environment variable to a very complicated string, for instance:


This is unfortunately complex... fortunately the ** dircolors** program can generate this data given a file. I found this Github project that has a library of themes for ls.

git clone .dircolors-solarized

Just add this code to your .profile or .bashrc file:

echo 'eval $(dircolors ~/.dircolors-solarized/dircolors.ansi-light)' >> .bash_aliases

Note: the convention for ls is reversed, instead of telling ls you have a dark background you use the theme style, i.e. a light style for a dark background. You should see the ls colors change as shown below.