Vim Recipes Extending Changing the Colour Scheme

Changing the Colour Scheme

Problem

You don't like the colours Vim uses; you want to change them.

For example, you've found a colour scheme you like better, so want to instruct Vim to use it. Or, you find that the current colour scheme makes text hard to read so want to find a more suitable one.

Solution

To browse existing colour schemes enter :colourscheme, then hit <Tab> to cycle through the installed schemes. If you find one that you like hit <Enter> to apply it.

Discussion

A colour scheme is a set of rules controlling how different elements of the interface appear. Vim is distributed with a selection of colour schemes, but you can also download new ones, as explained in the sidebar.

The Vim Color Scheme Test is a a gallery of colour schemes along with their names. Browse through it to select a theme you like, then follow the instructions below to install it.

Installing Colour Schemes

  1. Browse the available colour schemes at Vim.org and download any that you like.
  2. Create a $VIM/colors, e.g. mkdir -p ~/.vim/colors on POSIX systems.
  3. Copy the .vim file you downloaded in step one to the colors directory you just created.
  4. Open vim then execute :colorscheme name, where name is that of the file you downloaded without the .vim extension.
  5. If you want to use this colour scheme permanently add colorscheme name to your vimrc; otherwise repeat these steps with a different colour scheme.

Before you change your color scheme you may like to make a note of what you're using at the moment. You can find the name of the current scheme with :echo g:colors_name.

To change a specific aspect of a colour scheme you can redefine a highlight group.