Is it possible to setup a specific colorscheme for a specific filetype in a vimrc file?

PlainBoringWhite for .txt

SomethingDarkBackdround for .c or .rb

link|improve this question
feedback

migrated from programmers.stackexchange.com Apr 13 '11 at 17:32

This question came from our site for professional programmers interested in conceptual questions about software development.

2 Answers

up vote 3 down vote accepted

While you could use an aucommand to set a specific colorscheme for a specific filetype or filename pattern, it is more common to use a syntax file to define highlight groups for elements and then use your global colorscheme to handle coloring of those groups.

link|improve this answer
feedback

As @Rein mentioned, you can use autocommand to achieve what you want. Add something like this to your .vimrc file:

"default colorscheme
colorscheme solarized

"different colorscheme for ruby and markdown
autocmd FileType ruby colorscheme railcasts
autocmd FileType markdown colorscheme mac_classic
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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