3

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.

1
  • 1
    Have you checked what your TERM environment variable is under both bash and tmux?
    – kejadlen
    Commented Jan 11, 2012 at 18:41

1 Answer 1

5

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?

1
  • Thanks! I had my term setup right and had the screen-256color option. the tmux -2 fixed it for me.
    – mouche
    Commented Apr 19, 2012 at 8:02

You must log in to answer this question.

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