7

I'm trying to set my colorscheme in the modeline. I tried it a few ways, but none of them works. I get an "Unknown option: colorscheme" error.

# vim: colorscheme dark_foo:set ft=foo:

How can it be set in the modeline?

7

The modeline consists of option settings. There is no "colorscheme" option. colorscheme is just a command that essentially executes "runtime colors/foo".

You can get an approximation of what you're asking for by creating an autocmd that sets your colorscheme and is triggered by some option that is actually settable in your modeline.

4

detailing answer of Laurence, example: force js highlighting:

first line of file you want to get the intended highlighting: # vim: ft=javascript

If you want you can then deviate from the default colorscheme via .vimrc:

autocmd FileType javascript colorscheme badwolf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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