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
kush
  • 16,408
  • 17
  • 48
  • 65

10 Answers10

41

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

Geoff Reedy
  • 34,891
  • 3
  • 56
  • 79
  • I'm using MacVim, but I'm facing the same issue. I could not find a .gvimrc in my home directory. Could you help me? – Nikhil CSB Dec 21 '19 at 15:21
9

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.

edlich
  • 89
  • 1
  • 3
8

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.

blade
  • 2,285
  • 1
  • 18
  • 12
  • I had to use this when the theme was not properly setting the `g:colors_name` value properly. Fixing this in the theme solved the issue. – ericbn May 04 '17 at 23:57
6

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.

fnurl
  • 160
  • 1
  • 6
3

Do you have syntax on in your .vimrc?

Benjamin Oakes
  • 12,262
  • 12
  • 65
  • 83
3

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

Jon Bartlett
  • 63
  • 1
  • 6
  • Really odd but this finally fixed issue on my mac. Didn't work: ```set background=dark``` Did work: ```set background=light``` Gotta get my peachpuff colorscheme! – tavor999 Mar 18 '20 at 14:18
2

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

Amit Moscovich
  • 2,858
  • 1
  • 21
  • 12
1

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

1

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

Janki Gadhiya
  • 4,492
  • 2
  • 29
  • 59
debo
  • 372
  • 2
  • 11
1

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
jef
  • 3,890
  • 10
  • 42
  • 76