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.

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

PlainBoringWhite for .txt

SomethingDarkBackdround for .c or .rb

share|improve this question

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 2

up vote 5 down vote accepted

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
share|improve this answer

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.

share|improve this answer

Your Answer


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

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