Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When SSH'd into another machine, I use Vim as my text editor, and I'm trying to add Tmux to my tool set as well. However, when I use vim through Tmux, the colors are completely wrong, and Vim is unusable. Even when not using Tmux, the colors are slightly off, but it's still usable.

Here's a screenshot of Vim by itself (not using Tmux): Vim by itself

Here's a screenshot of Vim with Tmux: Vim with Tmux

There's nothing in my ~/.tmux.conf, and I don't have any color modifications in my ~/.bashrc. Can anyone shed some light on why this is occurring? Thank you.

share|improve this question
1  
Have you checked what your TERM environment variable is under both bash and tmux? – kejadlen Jan 11 '12 at 18:41

I've got a solution:

Do this command in each environments.

for i in {0..255} ; do
    printf "\x1b[38;5;${i}mcolour${i}\n"
done

Though my tmux has:

set-option -g default-terminal screen-256color

but in tmux, the colour is bad and different than urxvt (the result in urxvt is same as xterm).

So launch tmux by

tmux -2

This forces tmux to behave as if it's running terminal can output 256 colours.

Then run your vim.

Did your problem fixed?

share|improve this answer
    
Thanks! I had my term setup right and had the screen-256color option. the tmux -2 fixed it for me. – mouche Apr 19 '12 at 8:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .