vim colorschemes not changing background color

Vegar picture Vegar · Dec 1, 2010 · Viewed 69.3k times · Source

I try to apply various color schemes in vim that I have seen on the net. Whatever scheme I choose, the background remains white, even though screenshots of the applied scheme shows that the background should be colored.

In some schemes, some of the background change color, but space right of lines containing text still remains white.

I'm using Vim 7.2 on a mac. I have just started messing with non-gui applications, so everything should be pretty much as it was out of the box..

Does the overall settings for the terminal window have something to do with it?

When running macvim, everything looks ok. Its only when starting vim from the terminal things looks strange..

Answer

cptloop picture cptloop · Aug 14, 2013

I have this in my .vimrc and it solved this problem for me using while using PuTTY.

set t_Co=256
set background=dark
colorscheme mustang
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE

It's important to load the colorscheme before the ctermbg settings in .vimrc because they need to override the same ones set by the colorscheme. This also means you can't switch colorscheme while Vim is running and expect it to work.