Ubuntu – Vim in tmux display wrong colors

tmuxvim

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

Best Answer

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.

Related Question