Gvim how to change exisitng colorscheme’s syntax colors

color-themegvimsyntax highlightingvim

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?

Best Answer

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
Related Question