Vim in tmux display wrong colors

Solution 1:

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.

Solution 2:

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

Solution 3:

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

Solution 4:

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.

http://scie.nti.st/dist/256colors2.pl

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