:syntax on
You will immediately see how Vim automatically identifies the syntaxes of the programming language and highlights them in different colors. To make this a permanent, add the line “syntax on” to your “.vimrc” file located in your home directory.
Vim Color Scheme
Although your Vim screen may look good, often you might notice that colors of some syntaxes make it difficult to read depending on your terminal’s background color. This issue can be solved by using Vim’s available color schemes.
By default, Vim may offer a variety of colorschemes like evening, elflord, default. desert, koehler, murphy, morning, peachpuff,pablo, ron, slate, shine, torte, and zellner. These colorschemes offer rich colorful Vim experience. The way to try one of these colorschemes is to open a file using Vim and type (in command mode)
:colorscheme desert
If you want to try more than one colorscheme, type
:colorscheme, a space and use tab to go through each colorscheme to choose the one you like.
If you have a black/dark background, the colorscheme “desert” is probably the best chance to see all your synatxes easily.
More Vim Color Schemes
If you are an adventurous type and did not like any of these colorschemes offered by Vim, don’t worry. There are more colorschemes available to you. Visit Vim’s color themes page and download the one you like.
As you can see, there are more than 500 Vim color schemes created by users. Don’t worry, You don’t have to manually try each color scheme, Google Code is there to help you. Google Code has a colorscheme test page and lists how the over 400 color schemes will look like for C, HTML, Java, perl and LaTex files. Once you like a scheme download the color scheme fle and move it to the directory “~./vim/colors” and add the line
colorscheme yourfavorite
in your .vimrc file. Remember that for the color scheme to work you also need to have “syntax on”.