0xY*_*NTI 324
该TMUX FAQ明确建议不要设置TERM比其他任何东西screen或screen-256color或tmux或tmux-256color在你的shell init文件,所以不要做吧!
这是我使用的:
~$ which tmux
tmux: aliased to TERM=xterm-256color tmux
Run Code Online (Sandbox Code Playgroud)
在我的 .tmux.conf 中:
set -g default-terminal "screen-256color"
Run Code Online (Sandbox Code Playgroud)
别名tmux为“ tmux -2”也应该可以解决问题。
并且不要忘记重新启动您的 tmux 服务器:(请参阅@mast3r 答案)
tmux kill-server && tmux
Run Code Online (Sandbox Code Playgroud)
小智 51
尝试在 bashrc 或 zshrc 中明确设置 256 种颜色:
export TERM=xterm-256color
Run Code Online (Sandbox Code Playgroud)
或者
export TERM=screen-256color
Run Code Online (Sandbox Code Playgroud)
如果您在使用屏幕术语设置时 tmux 无法正确清除背景颜色的问题,您可以尝试:
export TERM=screen-256color-bce
Run Code Online (Sandbox Code Playgroud)
use*_*062 32
根据tmux 常见问题解答,将其添加到您的~/.tmux.conf:
set -g default-terminal "screen-256color"
Run Code Online (Sandbox Code Playgroud)
然后为 tmux 添加这个别名:
alias tmux='tmux -2'
Run Code Online (Sandbox Code Playgroud)
无需覆盖TERM配置文件中或启动时的变量tmux。
更多信息:http : //vim.wikia.com/wiki/256_colors_setup_for_console_Vim
Gab*_*ent 19
最新版本的 ncurses 附带了tmux-256color terminfo 条目(常见问题解答确实提到了这一点)。例如,使用tmux-256color优于screen-256color的好处是斜体可以正确呈现(屏幕不支持斜体)。
因此,如果您正在使用tmux 2.6或更高版本,并且拥有最新的 ncurses 包,以下内容也将起作用:
set -g default-terminal "tmux-256color"
Run Code Online (Sandbox Code Playgroud)
小智 13
对于拥有最新 tmux 的人,已.tmux.conf接受答案中的选项应该有效。
我只想补充一点,您可能需要重新启动 tmux 才能使新配置生效:
tmux kill-server && tmux
有趣的是,这在答案中的任何地方都没有提到,我花了一段时间才弄清楚。
小智 11
以下几行~/.tmux.conf对我有用——
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
Run Code Online (Sandbox Code Playgroud)
测试于
小智 9
我无法解释为什么这有效,但它为我解决了问题。
~/.tmux.conf
set-option -g default-command bash
Run Code Online (Sandbox Code Playgroud)