Solarized theme on Vim + Terminator + Ubuntu 11.10

test123 picture test123 · Feb 2, 2012 · Viewed 18.6k times · Source

I am trying to setup solarized theme for vim on Terminator but it is not working. :-( I was successfully able to setup solarized for terminator but it just doesn't seem to work for vim. Here is what my .vimrc looks like

call pathogen#infect()
filetype plugin indent on
syntax enable
set background=dark
"set t_Co=16
"let g:solarized_termcolors=16
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized

$TERM is set to xterm

I have also tried it with the two lines above uncommented but still not working.

Could someone please tell me what I am doing wrong?

Thanks!

Edit: solarized vim

Answer

As Ethan Schoonover pointed out in his vim colorscheme readme, to make the colorscheme work first you have to configure your terminal colour palette.

In terminator there is a github repo that holds the colour configuration for the dark and light scheme.

The problem is that that palette isn't right either :P, the correct one is the one a guy posted in an issue on that same repo.

The correct configuration is the following (at least for the dark scheme):

[[solarized-dark]]
  palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
  cursor_color = "#eee8d5"
  foreground_color = "#eee8d5"
  background_color = "#002b36"

After that, you have to configure the solarized colorscheme:

syntax on
set t_Co=16
set background=dark
colorscheme solarized

A couple of things to have in mind:

  1. Normally, the set t_Co=16 line is not necessary because most terminal emulators only support 16 colours (terminator for example). But I rather be explicit than implicit (specially if you are going to sync your files between multiple computers).

  2. The line set g:solarized_termcolors=16 is the default, so you can put it or not: it won't make any difference.

  3. In my experience the 256 colour version is better (I like more grey background over a blue one; but that's personal taste :P). Contrary to what everyone could think, the 256 colour scheme is actually the 'fallback' being the 16 one the default. Yeah, weird, most people would think that 256 > 16. Anyway, to use the 'fallback' you have to change the lines to the following:

    set t_Co=256
    set g:solarized_termcolors=256
    
  4. There are actually some issues with colour output in other CLI applications, I suggest you to go and read Seebi article about dircolors and an ongoing(?) discussion on the solarized github issue tracker.