I'm having trouble getting the full range of colors to work in vim when I'm running through tmux. I belive that it's some sort of trouble with TERM variables or 256colors, but I've done everything I have been able to find online to get 256 colors working in vim, tmux, and iTerm, and nothing has fixed it. It's a small problem, but it seriously bugs me.
Here's an example code file in vim just through iTerm:
and here's the same file in vim through tmux and iTerm:
Notice how the background colors seem slightly mismatched, only when code is written there. Why could this be?
I have set t_Co=256
in my vimrc
, my iTerm terminal is set to xterm-256color
, I have set -g default-terminal xterm-256color
in my tmux.conf
, and I have:
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
in my .profile
. This exact issue is replicated on my Ubuntu based machine at work, and I use all of the same configuration files there. This at least isolates the issue as not being OS/iTerm related.
TERM=screen-256color
inside tmux.export TERM=screen-256color
just disables all coloring.