VIM: How to configure Solarized colorscheme in Konsole

I am trying to configure Solarized for use in VIM in Konsole (KDE terminal). This is the result that I get: Konsole with Solarized

Note that Solarized looks fine in GVIM on the same machine: GVIM with Solarized

I suspect that it is Konsole's profile (colorscheme) that is the problem, but I do not see how to configure Konsole properly. I tried to use the Solarized .Xresources file hoping that would improve Konsole support, but it did not.


Solution 1:

The theme works fine in gVIM because gVIM supports 16.7 million colors, the Solarized colors being among them.

In the terminal, Solarized will use the 16 default ANSI terminal colors. This will look terrible unless you install the Solarized theme for your terminal emulator. There are many versions available for Konsole, you should browse around and pick the most accurate one. Once installed, the theme will replace the 16 ANSI colors (usually quite plain) with the Solarized ones, 'Solarizing' your whole terminal (or rather any application with color).

The alternative is to tell Solarized to 'degrade' to the basic 256-color palette that many terminal emulators support. The colors you get will not represent the true Solarized colors, but are an approximation. You can enable the degraded 256-color version of Solarized by adding let g:solarized_termcolors=256 to your .vimrc file.

Also, if the degraded colors STILL don't show up, add Daniel Andersson's answer to mine, and add set t_Co=256 to your .vimrc. (this should not be necessary if your $TERM is properly set, it should probably be xterm-256color)

Solution 2:

Mostly, follow http://vim.wikia.com/wiki/256_colors_in_vim.

In short:

  • Does the 256 color support work correctly in your terminal? Run some 256 color test (I use this script).
  • Is your $TERM value correctly set? The Vim wiki suggests TERM=konsole-256color for Konsole.
  • A correct term should set an equivalent to set t_Co=256 in Vim; you can also try setting this yourself (in the ~/.vimrc, before the color scheme is loaded).

Hopefully this can eliminate some error possibilities at least.