Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I installed Ubuntu 11.10. Then downloaded Solarized theme for Gnome Terminal. From terminal my vim looks good: plugin vim-powerline displays correctly and syntax is highlighted with proper colors. But when I run tmux and there run vim - syntax highlight uses only one basic color and vim-powerline displays no colors. I looked at the FAQ on vim-powerline and solution should be this line in .tmux-config:

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

But it doesn't work. I looked at TERM and it's return 'xterm' so I tried:

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

But this also dosen't help.

This is the only line in .tmux.config. In .vimrc I have following lines:

call pathogen#infect()
set nocompatible
set encoding=utf-8
set laststatus=2
let g:Powerline_symbols = 'fancy'
set t_Co=256
syntax enable
set background=dark
colorsheme solarized
share|improve this question
No idea why you got no upvotes, not even from those who must have benefited by getting upvotes from their own answers. +1 from me. The question is sound and it helped me solve my own problem, too, by finding it. – 0xC0000022L Jan 21 '13 at 16:09

10 Answers 10

Starting tmux with the following flag fixes this for me:

tmux -2

from tmux man page:

-2 Force tmux to assume the terminal supports 256 colours.

share|improve this answer
Good hint. When the Cygwin version of screen started to crash vim I switched back to tmux again very quickly. Love it. – Grant Bowman Jun 20 '15 at 3:56

I am having the same problem on Ubuntu 10.04 LTS using Byobu 5.17 & tmux 1.5 using the latest Solarized from the GitHub repo.

I was able to partially fix this by specifying $TERM in the .bashrc file:

export TERM="xterm-256color"

It seems, also, that there is a bug filed on launchpad, but it is not yet resolved: byobu not displaying dircolors properly

share|improve this answer
This is the only thing that worked for me! – Tranquille Jan 28 at 23:37
Also worked on Ubuntu 14.04 with tmux 2.0 – dukedave Mar 16 at 23:14
This is the solution on OS X as well haha – Wade Jun 21 at 23:49

Terminal type should be set to screen-256color in ~/.tmux.conf. It tells tmux what to set the TERM evironment variable, so it won't work for the current session - start a new one and test then.

If it still doesn't work, you can run Vim using:

TERM=screen-256color vi

This sets the environment variable just for a one-off vi execution.

If that doesn't make vim display all the colours, test if your terminal (I'm not sure if you're testing with just one terminal emulator) is compiled to support the 256 colour palette - download and run the below Perl script from the terminal emulator in question.

PS. I assume you've already corrected the typo jordanbrock noticed.

share|improve this answer

this worked for me

in .tmux.conf

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

in .vimrc

set term=screen-256color

remove old term value for .vimrc, believe me this will work

share|improve this answer

There's a typo in the last line of your .vimrc.

It should be colorscheme solarized

Not sure if that helps :)

share|improve this answer

You may be having the same problem documented in this answer.

Basically, .tmux.conf setting works, and TERM is set to screen-256color, but then tmux opens bash and calls your .bashrc, which sets TERM to something else (perhaps xterm-256color).

The solution is to set TERM in your terminal settings rather than in .bashrc. If that's not an option, you can check TERMinside .bashrc and not change it if it's already screen-256color.

share|improve this answer

In the shell starting tmux, check that $TERM is either xterm-256color or screen-256color. See how to change $TERM:

As an alternative, as Holy Mackerel said, you can force tmux to 256color via:

$ tmux -2
share|improve this answer

[Solucion][1] that may disturb your vision and make Vim unpleasant to use for an extended period of time.

You can fix this by running :set term=screen-256color in Vim or by relaunching Vim under the TERM=screen-256color environment, as some experts recommend:

share|improve this answer
What do you mean by [Solucion][1]? Were you trying to refer or link to another answer? Answers don't always appear in the same order. I recommend expanding this to clarify what you're saying may "disturb your vision and make Vim unpleasant to use for an extended period of time." – Eliah Kagan Aug 11 '14 at 15:32

As explained by Marcin Kaminski, if TERM=screen-256color vim works for you then just add following to your .bashrc
TERM=screen-256color and following in your .tmux.conf set -g default-terminal "screen-256color"

I had the same problemd, this works for me.

share|improve this answer

In your .bashrc or .zshrc just add

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

and also start with the tmux -2

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.