5

I have a bit of an odd issue as far as I can tell. When I use tmux I don't get color within the terminal (all text is white, even for things like ls), but my colors work perfectly for vim and other things like that.

In my .tmux.conf file I have the line set -g default-terminal "screen-256color", which is what most people say solved their problems. I also tried starting tmux by typing tmux -2, but that doesn't change anything.

I'm kind of at a loss at this point, so thanks in advance for any help you can offer!

OS: Ubuntu 16.04

Tmux Version: 2.1

1

I can help you solve the symptom, but not the root of the problem. The design of the prompt is configured in the variable PS1.

Outside tmux, this is the value:

$ echo ${PS1} # outside tmux
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

This is the value inside tmux:

$ echo ${PS1} # outside tmux
${debian_chroot:+($debian_chroot)}\u@\h:\w\$

to fix the problem, you can run this command inside tmux, and the prompt will immediately look normal for the current window:

PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

edit: I solved it by adding the following line to ~/.tmux.conf

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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