Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have 256 colors working just fine in konsole,. I thought I'd give tmux a try because, unlike screen, it seems to support vi mode. However I find that the colors of my prompt show up and this is most likely because I have a 256 color mode prompt. What do I need to do to get tmux to recognize all 256 colors?

share|improve this question
add comment

2 Answers

up vote 74 down vote accepted

The tmux FAQ ( http://tmux.cvs.sourceforge.net/viewvc/tmux/tmux/FAQ ) explicitly advises against setting TERM to anything other than screen or screen-256color in your shell init file, so don't do it!

Here's what I use:

~$ which tmux
tmux: aliased to TERM=xterm-256color tmux

and in in my .tmux.conf:

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

Aliasing tmux to "tmux -2" should also do the trick.

share|improve this answer
2  
I like the way to set it in the .tmux.conf best... using the shell to set it just doesn't seem right –  xenoterracide Aug 24 '10 at 5:38
2  
Weird. You don't need tmux -2 on OSX but you need it with Gnome Terminal. Thanks for the info, added to my aliases! –  F.X. Dec 8 '12 at 16:53
    
In Kubuntu 13.10 the .tmux.conf setting alone did not get me my 256 colors back (which took out highlighting in vim visual mode) but the alias worked. Would certainly prefer a .tmux.conf file only solution. –  Jacob Dalton Dec 7 '13 at 21:53
    
ssh'd into an Ubuntu machine (from OS X Terminal), the .tmux.conf default-terminal was all I needed. –  duelin markers Mar 13 at 16:19
add comment

Try setting 256 colors explicitly in your bashrc or zshrc:

export TERM=xterm-256color

or

export TERM=screen-256color

If you have problems with tmux not clearing the background colors correctly when using the screen term setting, you can try:

export TERM=screen-256color-bce
share|improve this answer
    
the first one is my default TERM setting... I just tried the other 2 and my prompt still doesn't show colors once I enter tmux. (I would like to note that tmux does show colors at the bottom)... it seems that when I enter tmux that it resets the TERM to TERM=screen... perhaps theres a way to override this in a config? –  xenoterracide Aug 23 '10 at 9:17
    
nvm... I guess putting it in a my shell's rc does work... how annoying that it ignores the TERM env variable that's set when I execute tmux... I guess I'll have to put a conditional in my rc. –  xenoterracide Aug 23 '10 at 9:21
    
-bce is not compatible with tmux. Tmux does not support background color erase: –  Dustin Kirkland Jan 15 '12 at 14:32
    
This (first one) is the only thing that worked for me so far, after trying lots of other suggestions. Finally consistent! –  hoosierEE Feb 21 at 19:48
    
This seems to be the only thing that works for me, too. I tried tmux -2 + set -g default-terminal "screen-256color" without success. export TERM=... works out of the box, no need for either tmux -2 or set -g .... On Manjaro, btw. –  Sebastian Feb 23 at 13:29
add comment

Your Answer

 
discard

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.