12

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.

1
  • Here, "Tom from the Internet" Youtube channel explains pretty well how to coordinate vim and terminal color themes. Modern 2020 video - youtu.be/Dr7ByHXy1Uw
    – Cymatical
    Sep 26, 2021 at 17:36

2 Answers 2

6

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)

1
  • 4
    Thank you. Adding let g:solarized_termcolors=256 to .vimrc resolved the issue.
    – dotancohen
    Jun 26, 2012 at 10:31
5

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.

1
  • Clever script, thanks! It shows that all the colours work as intended. TERM was xterm-256color but even setting it to konsole-256color and then launching VIM did not help. Also, running :set t_Co=246 in the running VIM did not help either.
    – dotancohen
    May 12, 2012 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.