Solarized colors in vim don't seem to be working for me

8

1

I am running vim, and trying to get the vim solarized colors to work in terminal.

I have this in my vimrc file:

set syntax on
set t_Co=256
" let g:solarized_termcolors=16
set background=light
colorscheme solarized

It doesn't seem to work.

I outputted (using :echo) the value of t_Co and it is 256.

What is the issue? I'm confused.

user27449

Posted 2011-07-16T22:04:25.900

Reputation: 5 104

why is the g:solarized_termcolors=16 line commented out? – Uku Loskit – 2011-07-16T22:10:14.663

because uncommenting it did not have any impact, its still all messed up, background is white, numbers on the left have a greyish background, and wherever there is text is greyish background. – user27449 – 2011-07-16T22:14:20.207

Answers

6

I had similar problems, adding this to my .vimrc fixed my problems

set term=xterm-256color
set background=light
colorscheme default

I'm not sure why setting the color scheme to default worked but I'm using solarized light as my terminal theme so maybe the colors are just similar to solarized, however they're good enough for me.

cerberos

Posted 2011-07-16T22:04:25.900

Reputation: 172

3set term=xterm-256color was the way to go for me. – deadalnix – 2012-09-23T01:58:40.973

2This is not setting the colorscheme to solarized. – IanVaughan – 2013-11-18T14:38:23.500

4

You need to do:

let g:solarized_termcolors=256
set background=light
colorscheme solarized

let g:solarized_termcolors=256 enable degraded color mode. This is needed only if you do not apply solarized colors to your terminal emulator.

Pablo Castellazzi

Posted 2011-07-16T22:04:25.900

Reputation: 931

should I remove t_Co=256? When I did what you put, my entire terminal was blinking every second or so.... – user27449 – 2011-07-17T04:10:02.253

Forcing the number of colors may work, but usually not. Set TERM environment variable to something appropiate for your emulator. What kind of terminal are you using? – Pablo Castellazzi – 2011-07-17T18:49:55.423

I am on mac osx leapard, using the standard terminal. – user27449 – 2011-07-17T19:53:47.383

Solarized's author explain how to setup Terminal.app properly here

– Pablo Castellazzi – 2011-07-17T20:18:54.190

3

Add to your ~/.vimrc

" Solarized Dark
syntax enable
set t_Co=256
let g:solarized_termcolors=256
set background=dark
colorscheme solarized

This works on both ansi and xterm-256color versions of Solarized. Tested on Terminal 2.3 on a new OS X 10.8.5 VM installation.

NB This answer supersedes the previous one that proposed changes to the profile swatches. I recently realised I had these commands in my .vimrc file that actually configured Solarized.

1.61803

Posted 2011-07-16T22:04:25.900

Reputation: 293

3

I have spent an 2-3 hours trying to figure it out. This is how to configure this color scheme with Vim.

Make sure you do not start tmux first. Sometimes it messes with the terminal color scheme.

  1. set syntax on
  2. :echo &t_Co in vim and see what you get. If it's 8 you'll want to set t_Co=16 and if it's 256 than set t_Co=256
  3. if you have set t_Co=256 than next is :let g:solarized_termcolors=256 or t_Co=8 and :let g:solarized_termcolors=16
  4. set background=light or set background=black
  5. And finally colorscheme solarized

vrkansagara

Posted 2011-07-16T22:04:25.900

Reputation: 191

1

I had the same problem with the default terminal, which do not support 256 colors. I installed iTerm2 and that solved the problem.

Edit:

Also, you need to install Solarized for iTerm2.

Tae

Posted 2011-07-16T22:04:25.900

Reputation: 183

Thanks, I have been searching for this solution over a week but this works great. – Dimpu Aravind Buddha – 2017-07-19T22:35:02.750

0

Well,

  1. First, Download solarized.vim to your .vim/colors folder

  2. Next, Download togglebg.vim to your .vim/autoload folder

Try to launch vim again & see if it works. If not, come back with error message

CuriousMind

Posted 2011-07-16T22:04:25.900

Reputation: 101

Tried that, and no change. I do get this error but I think its unrelated (after I installed command-t) vim/bundle/vim-makegreen/plugin/makegreen.vim: line 73: E227: mapping already exists for \t – user27449 – 2011-07-16T23:10:47.447