Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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: http://andrewradev.com/2011/08/06/making-vim-pretty-with-custom-colors/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.