VIM Color scheme not loading by default
When I do
:colorscheme vilight
it loads the color scheme fine.
So I added
colorscheme vilight
to my .vimrc but its not loading it on start. Am I missing something?
Also in my config
set 开发者_开发百科background=dark
syntax on
colorscheme vilight
set lines=60 columns=200
Are you using gvim? It is possible that your .gvimrc or the system's gvimrc file is overriding the colorscheme selection from your .vimrc.
Sometimes it helps to put the colorscheme at the end of the _gvimrc .gvimrc file which is read (after SYNTAX ON). Also be sure that HOME is read. Sometimes gvim still reads from the installation path.
For Macvim, the solution would be add the following into your .vimrc:
let macvim_skip_colorscheme=1
Then it will respect your choice in .vimrc.
I have the same problem! MacVim does not load my colorscheme on start. However, vim run from the command line does. Is this a MacVim issue then?
I cleared my .vimrc and just left the colorscheme lines and it still does not work.
set background=dark
colorscheme solarized
syntax on
However, doing
:set background=dark
:colorscheme solarized
after startup works.
UPDATE: I found out that MacVim loads both .vimrc and .gvimrc and in my case, stuff in .gvimrc was the problem.
Do you have syntax on
in your .vimrc
?
Had the same problem. Commenting out set background=light
in file .gvim
fixed the issue for me.
I've had this problem too when I took a .vimrc from gVim for windows and used it with MacVim.
I noticed that the vi that comes with snow leopard complains about lines ending with ^M (aka carriage return, or "\r"). After converting the dos-style newlines to unix-style the problem was solved. (*)
MacVim does not complain about this, but apparently does have a problem loading the .vimrc when it contains dos-style newlines.
(*) - Dos/windows style new lines are composed of a carriage return and a line feed ('\r\n'), unix style newlines contain only a line feed ('\n').
Just add line "source .vimrc" in the end of .gvimrc
If you are using MacVim I had problems loading downloaded color schemes too. I found out that if you move the color schemes to:
/Applications/MacVim.app/Contents/Resources/vim/runtime/colors
Then it would work in your .gvimrc
For MacVim users, deleting the following native vimrc and gvimrc probably works.
rm /Applications/MacVim.app/Contents/Resources/vim/vimrc
rm /Applications/MacVim.app/Contents/Resources/vim/gvimrc
精彩评论