VIM Color scheme not loading by default

懵懂的女人 提交于 2019-12-03 08:08:41

问题


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

回答1:


Are you using gvim? It is possible that your .gvimrc or the system's gvimrc file is overriding the colorscheme selection from your .vimrc.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


Do you have syntax on in your .vimrc?




回答6:


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').




回答7:


Had the same problem. Commenting out set background=light in file .gvim fixed the issue for me.




回答8:


Just add line "source .vimrc" in the end of .gvimrc




回答9:


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




回答10:


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


来源:https://stackoverflow.com/questions/2637929/vim-color-scheme-not-loading-by-default

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!