gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.54k stars 3.33k forks source link

${TERM} always set to tmux-256color, how to change it #731

Closed QiMingZhenFan closed 4 months ago

QiMingZhenFan commented 4 months ago

Thanks for your work!

I am using zsh & tmux in Ubuntu 18.04. Ouside tmux, the TERM is xterm-256color. However, inside tmux TERM is tmux-256color,eventhough I set set -g default-terminal "xterm-256color" in ~/.tmux.conf.local.

screenshot-20240314-175328

I restart tmux by tmux kill-server, but nothing changes. BTW, set -g default-terminal "screen-256color" doesn't work yet.

Is there something wrong with my usage? I want to change ${TERM} to screen-256color or xterm-256color, because glog does not support outputing colored words in tmux-256color.

gpakosz commented 4 months ago

Hello @QiMingZhenFan 👋

You need to either

QiMingZhenFan commented 4 months ago

@gpakosz Thanks for your reply!

I happened to read your earlier reply in other issue. I tried this command set -g default-terminal xterm-256color #!important, it worked! But without #!important, this command still makes no changes to ${TERM}, why is this?

screenshot-20240314-182606

gpakosz commented 4 months ago

This is because the .local file is used for 2 purposes

When the top level .conf file is sourced, it then sources the .local file to know the values of the tmux_conf_... variables, then proceeds with customizing tmux: in this case, it detects that tmux-256color is available and decides to use it. It also updates some bindings. Finally, it scans the .local file again for set, bind and unbind directives marked with #!important (inspired by CSS), and applies these in a last pass.

QiMingZhenFan commented 4 months ago

Oh, I think I understand. That's cool! Thank you very much for your detailed and kindly explanation! :D