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.

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
2  
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
1  
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
1  
I just added the answer to this to your other question that also asks this. –  garyjohn Oct 6 '13 at 1:50
1  
I'm sure @garyjohn enjoyed wasting his time on this beautiful case of XY problem. –  romainl Oct 6 '13 at 7:02
show 3 more comments

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.