Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use gvim and the color scheme which I use is called 'slate'. I mostly just code in python, html and css and I like slate's syntax coloring except for a few syntax colors. Is it possible for me to change a few of the syntax colors? For example, it colors all html tags blue, is it possible if I can change it to, say, red?

share|improve this question
up vote 2 down vote accepted

There are two abstractions for syntax coloring in Vim. First, the syntax plugin provides definitions for the various syntax elements (e.g. an HTML tag name -> htmlTagName), and links them to generic highlight groups (e.g. Statement). A colorscheme then provides the actual attributes and colors for those (which can depend on whether you use GVIM or a terminal).

If you don't like the color / formatting of a particular highlight group, you'd basically create your own customized fork of the colorscheme. Copy the existing colors/schemename.vim to ~/.vim/colors/newscheme.vim, and use the new name in your .vimrc via the :colorscheme newscheme command.

On the other hand, if you're fine with the general colors, and just think that a particular syntax element should use a different group, you can override the default assignment. In this example:

:syntax link htmlTagName Constant
share|improve this answer

gvim has files (eg. slate.vim) in a colors directory wherever it is installed. Where that is OS dependent. You could change them in there and it will change for all users.

You can override by putting a colors file (on Linux) in .vim/colors in your home directory. Not sure what to call the directory in windows. This looks like a pretty comprehensive tutorial:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .