1

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?

2

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
1

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/

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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