vim colorschemes not changing background color
Solution 1:
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.
Solution 2:
I'm adding a second answer from me because it's very different from my first answer and may point to actual problem.
If you look at the actual website for the colorscheme here: Molokai website
you will see a question very similar to yours. Here's answer given, which suggests trying command :set t_Co=256
in your vimrc to see if it fixes things:
"- Make sure you’re using a console terminal capable of 256 colors; not all of them do (particularly on mac). You might need to explicitly force Vim to use that by doing “set t_Co=256″ on your .vimrc file. - The windows console is well… totally unsupported, that only does 16 colors so it’s a mess"
Solution 3:
In linux I had export TERM=xterm-256color
in my .bashrc
. That caused vim to look like this (after setting set t_Co=256
):
When I removed that line from my .bashrc
and opened a new terminal (exec bash
didn't do it) This is what I get: