Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pass color schemes as parameters when launching vim ?

I use VIM with different types of files, so each time I need to set specific color schemes. Is it possible to pass them as parameters ?

Example: vim colorscheme=desert

Thanks.

like image 854
user710818 Avatar asked Dec 08 '11 15:12

user710818


People also ask

How do I use color scheme in Vim?

You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.

How do I permanently change vim color scheme?

How to Set Default Vim Color Scheme. Changes you have made to the color settings are not permanent. Once you close Vim, the color scheme returns to the default settings. To make the changes permanent, modify Vim's configuration file with the wanted color settings.

Where do VIM color schemes go?

View preinstalled color schemes Some color schemes are already installed on your system. You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.

How do I change the default color scheme in Gvim?

You can set your preferred color scheme in gvim for MS Windows by editing the file _vimrc in C:\Program Files\Vim or the location where you installed Vim. Save the file and start gvim you will see your color scheme.


2 Answers

vim -c "colorscheme desert" $file

or equally

vim +"colorscheme desert" $file

Note: you can use any command, not only colorscheme. For more information, see manpage.

like image 128
Matvey Aksenov Avatar answered Oct 17 '22 02:10

Matvey Aksenov


Another way is to use autocomand e.g. in your .vimrc

au BufEnter *.c  :colorscheme wombat
au BufEnter *.js :colorscheme desert
like image 42
Eric Fortis Avatar answered Oct 17 '22 02:10

Eric Fortis