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

okay so I want gvim to open all my files using the 'slate' color scheme except for .html and .css files. I want it to open .html and .css files using the 'ron' color scheme. I tried doing

colo slate
autocmd FileType html colorscheme ron
autocmd FileType css colorscheme ron

but it didn't work, it still opens .html and .css files using slate. Any idea on how to do this?

share|improve this question
The colorscheme is a global setting--it applies to all windows/buffers. You can't do what you want using colorschemes. However, you can modify the html and css syntax files to use colors you specify explicitly rather than using the color names they link to. – garyjohn Oct 5 '13 at 21:47
Hm okay and where can I find the html and css syntax files to change the colors which are being used? – user2719875 Oct 5 '13 at 21:58
They are in the $VIMRUNTIME/syntax directory, and have file names html.vim and css.vim. The value of $VIMRUNTIME depends on your system, but you can use it in a command such as :e $VIMRUNTIME/syntax/html.vim. You'll see lines at the bottom such as HtmlHiLink HtmlPreStmt PreProc. PreProc (or preproc) is a highlight group whose color is defined in $VIMRUNTIME/colors/ron.vim. If you copy html.vim to ~/.vim/syntax and edit the copy to define HtmlPreStmt as the colors used by ron, e.g., hi HtmlPreStmt guifg=Pink2 and so on, you should get the coloring you want. – garyjohn Oct 5 '13 at 23:59
I just added the answer to this to your other question that also asks this. – garyjohn Oct 6 '13 at 1:50
I'm sure @garyjohn enjoyed wasting his time on this beautiful case of XY problem. – romainl Oct 6 '13 at 7:02

You must log in to answer this question.

Browse other questions tagged .