I am having the same problem like the questioner in 256 color support for vim background in tmux.

In my normal terminal with zsh, I have no background color issues in vim, but when I run it inside tmux, I get issues with the background colors.

Apparently, there is a problem with using screen instead of xterm:

Outside Tmux: echo $TERM results in screen
Inside Tmux: echo $TERM results in xterm

In my .zshrc and .tmux.conf I have set


but it doesn't effect anything. (I also tried TERM=screen)

How can I force tmux to use screen?

EDIT: thanks to htor, I added set -g default-terminal "screen" (also tried set -g default-terminal "screen-256color") in .tmux.conf and in .zshrc export TERM=screen-256color.

Now I get:

Outside Tmux: echo $TERM results in screen-256color
Inside Tmux: echo $TERM results in echoscreen-256color (<- looks a little bit weird with, is the output correct?)

What else can I do to solve the background color issue in vim inside tmux?

2 Answers 2


As explained here, disable Background Color Erase (BCE) by clearing the t_ut terminal option (run :set t_ut= in Vim and then press Control+L to refresh the terminal's display) so that color schemes work properly when Vim is used inside tmux and GNU screen.


To set the default terminal variable for tmux change your .tmux.conf to:

set -g default-terminal "screen"

The shell syntax for setting variables will not work in .tmux.conf. In your .zshrc you should export the value of TERM to make sure all shells inherits this value in your environment:

export TERM=screen-256color
  • Thanks htor, with your advice i get now with echo $TERM in- and outside tmux "screen-256color". But the vim background-color issue inside tmux still remains. What else can i do to get rid of this annoying issue (i use tmux and vim a lot)? Mar 1, 2013 at 9:43
  • @Lennier Have you tried using xterm as TERM value and screen in tmux? Can you post a pastie of your .vimrc in your question?
    – user111228
    Mar 1, 2013 at 11:09

You must log in to answer this question.

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