1

In the Ubuntu version of gnome-terminal I'm seeing a weird problem with colors that I know is somehow related to gnome-terminal because this same setup works fine with iTerm2 on my Mac.

From terminal I ssh into a remote computer running Ubuntu 14.04 (14.10 on local, though). From here if I run vim I have 24bit color support as evidenced by the way my theme appears. Then I attach to a tmux session and run vim, but now I see weird colors in vim because it is continuing to use the 24bit color version, but is approximating to 16 colors.

This only happens from terminals on Ubuntu, though. In Mac OS X, for example, if I use iTerm 2 to do the same thing, the colors display correctly when running vim inside tmux.

I have already confirmed that I have 24bit color support in gnome-terminal. A couple of things of interest to perhaps note:

  • setting t_Co=256 in .vimrc is required for me to get 24bit color to work in gnome-terminal, though not in iTerm 2 where I can leave it unset. Looking at my color theme file this suggest that it's because has("gui_running") is true when run under iTerm 2 but not from gnome-terminal
  • it seems like the color downgrade is some interaction between tmux and gnome-terminal, since when not combined I can get colors to work right (either tmux with iTerm 2 or gnome-terminal without tmux)

Any suggestions on ways I might be able to get gnome-terminal and tmux to work well together to display 24bit color (or even just 256 color) in vim?

1

Nevermind, turns out that I just needed for force tmux to believe I have 256 colors (this became clear once I realized what it really meant that I was only seeing 16 colors inside tmux; I had previously mistakenly thought I was getting 256) using the -2 option.

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.