I am having a strange issue with iTerm2, in terminal vim (non-gui) and the solarized color scheme. First, I have set iTerm2 to use the dark solarized colour scheme.
I am also using solarized for vim. I have the following lines in my .vimrc
set background=dark colorscheme solarized
In the terminal the color scheme looks incorrect:
For reference this is how it looks under MacVim (gui vim)
What do I need to change in iTerm or my .vimrc to get the colors looking correctly in my console vim?
How to Set Default Vim Color Scheme. Changes you have made to the color settings are not permanent. Once you close Vim, the color scheme returns to the default settings. To make the changes permanent, modify Vim's configuration file with the wanted color settings.
If you just want to change the background color and font color, it's more easy. Just adjust the color on preferences>profile>colors .
A couple of things to check:
In iTerm2, in Preferences -> Profiles -> Terminal, under "Terminal Emulation" you have "Report Terminal Type:" set to xterm-256color.
In your .vimrc, there are some options you can also set to make sure it's using 256 colors:
And one of those should work, but #1 first.set background=dark " solarized options let g:solarized_visibility = "high" let g:solarized_contrast = "high" colorscheme solarized
BUT, if you're using the default, built in vim on Snow Leopard, it won't work, as it's not built with support for 256 colors. I believe the built in version in Lion does.
Edit: Based on several comments on this answer, I've removed let g:solarized_termcolors = 256
line from the .vimrc
example above. It appears that could be a problem for some. Another says that adding the line let g:solarized_termcolors = 16
fixed a color display problem. Your own mileage may vary.
Second Edit: If you've loaded the solarized color palette into iTerm2, then you must let g:solarized_termcolors=16
. Only let g:solarized_termcolors=256
if you are not using the solarized palette as your iTerm2 color preset.
The above answers didn't work for me.
I'm using iTerm2 with vim 7.3 on OS X 10.7.4.
If the above solutions didn't work for you too, try this
syntax on set background=dark let g:solarized_termtrans = 1 colorscheme solarized
Update: According to Jim Stewart, this works on Kitty too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With