Better colors so comments aren't dark blue in Vim?

There are many color schemes which are usually distributed together with vim. You can select them with the :color command.

You can see the available color schemes in vim's colors folder, for example in my case:

$ ls /usr/share/vim/vimNN/colors/ # where vimNN is vim version, e.g. vim74
blue.vim  darkblue.vim  default.vim  delek.vim  desert.vim  elflord.vim 
evening.vim  koehler.vim  morning.vim  murphy.vim  pablo.vim  peachpuff.vim
README.txt  ron.vim  shine.vim  slate.vim  torte.vim  zellner.vim

I usually use desert. So I open vim, then enter :color desert and enter. To have the color scheme by default every time you open vim, add :color desert into your ~/.vimrc.

(Michael, OP) This was good. The terminal looks like:

Example of VIM on a Ruby file showing syntax highlighting in various colors


As you are using a dark background in your terminal, you simply need to set

:set background=dark

instead of the default

:set background=light

The colors are then automatically correctly set.

If you want to have this permanently, add the line

set background=dark

to your $HOME/.vimrc file.


You can do it manually with this command:

:hi Comment guifg=#ABCDEF

Where ABCDEF is an appropriate color hex code.

To make it permanent, you will need to add these lines to your ~/.vimrc file (using green as an example):

syntax on
:highlight Comment ctermfg=green