Configuring solarized colorscheme in gnome terminal, tmux and vim
Asked Answered
J

2

19

I'm struggling to make the Solarized colorscheme correctly working on an Ubuntu 13.10 machine inside Vim inside tmux inside the gnome-terminal.

I've started configuring gnome-terminal using the script on this repository and it displays the colors correctly. The same goes if I run Vim (with the official Solarized colorscheme) inside the terminal, without tmux.

Then I tried to configure tmux using this. It happens that when I run Vim the syntax highlight for php or javascript code is wrong or, at least, different from the one I see running Vim without tmux. I've tried also running tmux as tmux -2. The colors are different, but still the syntax highlight is not correct.

Jelsma answered 16/4, 2014 at 19:54 Comment(3)
@romainl Your grumpy comments always put a smile on my face! Despite the negativity, there's always a bit of truth in them.Haase
Carlo: Take a look at it this gist gist.github.com/kraft001/2893831 and let us know if you got it working.Vimineous
@Vimineous no, it's the same. There is also an error in the script, at row 16, because in the directory doesn't exist any tmuxcolors.conf, but instead it's tmuxcolors-dark.conf.Jelsma
V
28

I tested it out and got it working in the following way:

  1. Install gnome solarized colorscheme. You can get it from https://github.com/aruhier/gnome-terminal-colors-solarized.

  2. Install solarized colorscheme for vim. You can get it from https://github.com/altercation/vim-colors-solarized. In .vimrc you should add following settings:

    set t_Co=256
    set background=dark
    colorscheme solarized
    
  3. Set correct TERM variable by adding following line to your .bashrc/.zshrc

    export TERM=screen-256color-bce
    
  4. Run gnome-terminal, tmux, vim and profit.

Vimineous answered 17/4, 2014 at 11:48 Comment(4)
Oh, great. Apparently the only thing missing was the export inside my .zshrc file. Thanks for your help.Jelsma
Except that forcing the TERM is bad practice blog.sanctum.geek.nz/term-stringsTraditionalism
For solution 2. to work you have to add let g:solarized_termcolors=256 before the line colorscheme solarized. SourceBedrabble
Note that gnome solarized colorscheme repository has changed. It is now : github.com/aruhier/gnome-terminal-colors-solarizedTuddor
T
8

These days GNOME Terminal comes with Solarized colours built in. To use it, you need to change two settings in the profile that you're using. The obvious one is the text and background colour. You also need to set the palette to Solarized, though. You can find this setting below the one for the text and background colour. At this point, setting t_Co or g:solarized_termcolors in Vim shouldn't be necessary.

The palette is the part that I missed at first, which caused me to puzzle why the text in Vim and other applications was bright blue.

Tighe answered 18/12, 2018 at 8:47 Comment(2)
That is true, however I want to have Tango palette for my gnome-terminal and solarized for vim. Is it possible to have solarized in vim without changing my gnome-terminal palette to solarized?Immoral
Not easily, I'm afraid. Probably there is a way to do it, but I don't know it.Diligence

© 2022 - 2024 — McMap. All rights reserved.