VIM Color scheme not loading by default

2019-03-11 14:40发布

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

标签: vim macvim
10条回答
聊天终结者
2楼-- · 2019-03-11 15:12

Do you have syntax on in your .vimrc?

查看更多
Animai°情兽
3楼-- · 2019-03-11 15:12

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

查看更多
萌系小妹纸
4楼-- · 2019-03-11 15:14

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

查看更多
唯我独甜
5楼-- · 2019-03-11 15:15

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
查看更多
来,给爷笑一个
6楼-- · 2019-03-11 15:18

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.

查看更多
我命由我不由天
7楼-- · 2019-03-11 15:19

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.

查看更多
登录 后发表回答