Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 set in the modeline?

like image 228
Adam Schmideg Avatar asked Dec 03 '10 18:12

Adam Schmideg


People also ask

What is Modeline vim?

modelines allow you to set variables specific to a file. By default, the first and last five lines are read by vim for variable settings. For example, if you put the following in the last line of a C program, you would get a textwidth of 60 chars when editing that file: /* vim: tw=60 ts=2: */

How do I add Colorscheme to Gvim?

vim` colorscheme file to the colors folder. Go to vim/mvim and use `colorscheme scheme_name` to use the corresponding colorscheme. To apply the corresponding colorscheme everytime vim/mvim runs, add the `colorscheme scheme_name` to your ~/. vimrc or ~/.


1 Answers

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.

like image 169
Laurence Gonsalves Avatar answered Sep 22 '22 21:09

Laurence Gonsalves