Set vim colorscheme in modeline
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 开发者_如何学JAVAset in the modeline?
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.
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
精彩评论