In runtime/doc/syntax.txt, line 4973 and 4974:
set -g default-terminal "xterm-256color"
set -ag terminal-overrides ",xterm-256color:Tc"
xterm-256color is wrong for default-terminal. It tells tmux to set $TERM to xterm-256color whenever the user opens a new window/pane; but in tmux, $TERM must be screen, tmux or a derivative, as documented at https://man.openbsd.org/tmux.1#default-terminal :
For tmux to work correctly, this must be set to ‘screen’, ‘tmux’ or a derivative of them.
There are several ways to set the options. As a suggestion:
set -s default-terminal "tmux-256color"
set -as terminal-overrides ",*-256color:Tc"
This tells tmux to set $TERM to tmux-256color, and to enable its true color capability feature (Tc) if the name of the real outer terminal ends with the string -256color (e.g. xterm-256color, gnome-256color, ...).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
I've been using tmux (latest in git, "next-3.3") with 256 colors without problems for a while.
My ~/.tmux-config contains (among other things):
set-option -g default-terminal "xterm"
I checked, this line alone in .tmux.conf is sufficient to have 256 colors.
And I use xfce4-terminal that comes with xubuntu-18.04.5.
In ~/.vimrc, I have:
set termguicolors`
My ~/.tmux-config contains (among other things):
set-option -g default-terminal "xterm"
Then it means that the programs that you are using are not asking for terminfo capabilities; or if they are asking, the values that they get are the same whether $TERM is xterm or screen, tmux, screen-256color, tmux-256color. But in the general case, we don't know which programs the user will be running, nor whether they'll ask for terminfo capabilities, nor how they'll use them; so it's best to respect tmux own documentation.
It's not just some minor nitpick. This is the cause of many subtle issues, to the point that the tmux devs have felt the need to include this in the CONTRIBUTING.md file which users having issues are expected to read before posting:
$TERM inside tmux is screen, screen-256color, tmux or tmux-256color. Check by running echo $TERM inside tmux.
I checked, this line alone in .tmux.conf is sufficient to have 256 colors.
Yes, with a recent tmux, you might not even need terminal-overrides. I think tmux is a bit smarter nowadays and auto-configure some options. In fact, if you need to set an option, you should use terminal-features, not terminal-overrides. But all of that is assuming that the user has a recent tmux. Again, we don't know that. They might be using 3.0; in which case, tmux won't auto-configure options, and terminal-features won't be available.