I have installed tmux but now text mode vim colorschemes do not fill the background colour properly. Here is how it looks with colorscheme xoria256 in the normal Ubuntu 14.10 terminal:

enter image description here

And here when I run it in the exact same terminal after tmux:

enter image description here

So as you can see the desktop is showing through anywhere where there is no text in vim. I have a 256 color terminal.

My .tmux.conf:

~ cat .tmux.conf
set -g mode-mouse on
set -g default-terminal "screen-256color"

and I have a 256 colour terminal:

~ tput colors

How do I get tmux to work properly with vim 256-colour colorschemes which work fine in the normal terminal?

  • In my experience, tmux behaves strangely when launched inside gnome-terminal. Try launching tmux with TERM=xterm tmux and see if it behaves differently. If xterm doesn't work, try xterm-256color or xterm-color.
    – jw013
    Nov 13, 2014 at 20:44
  • @jw03 Sadly none of those options worked to fix it. Identical behaviour. Same behaviour if I run tmux inside terminator Nov 13, 2014 at 21:03
  • 1
    In a shell inside tmux, what’s the value of $TERM? If it’s not screen-256color, try launching vim as TERM=screen-256color vim, then make sure no startup script sets TERM (or, if you need to do that to work around buggy software, make sure it checks the original value first).
    – Ry-
    Nov 13, 2014 at 22:55
  • @minitech: Bingo. I had xterm-256color whereas screen-256color fixes the problem. If you make this an answer I will accept it. Nov 13, 2014 at 23:06
  • This worked for me: stackoverflow.com/a/15095377/96855 Dec 14, 2016 at 4:49

3 Answers 3


in your .tmux.conf:

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

This happens when TERM isn’t set to the correct screen[-256color] in Vim’s environment, usually by some shell startup script. If that is the case – for example, you have a


, either remove it or make sure it checks the original value of TERM before changing it, e.g.

if [[ "$TERM" = xterm ]]; then

Late comment, but I had looked through all the threads and couldn't resolve it until I did the following. All I had to do was add a second check of

if [[ $TERM == screen]]; then

in addition to the first conditional statement in my .bashrc file:

if [[ $TERM == xterm ]]; then

I also had this in .tmux.conf:

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

In my .vimrc file:

set term=screen-256color

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.