jtp*_*yda 7 terminator environment-variables
根据这个答案,“设置 TERM 环境变量是终端模拟器的工作”。
有什么办法可以改变终结者使用的 TERM 值吗?现在是xterm,但我需要xterm-256color。
我使用其他终端仿真器(Gnome Terminator、tmux),因此在我的 .bashrc 中设置充其量会很混乱。
小智 10
我这样做的方式是使用 a custom_commandin ~/.config/terminator/config,如下所示:
...
[profiles]
[[default]]
...
custom_command = TERM=xterm-256color bash -l # Do not use 'terminator' here
use_custom_command = True
...
Run Code Online (Sandbox Code Playgroud)
这就像一个魅力,即午夜指挥官的 256 色皮肤
。该-l选项使 bash 作为登录 shell 运行(这意味着它将从您的.bash_profile. 如果您更喜欢 Terminator 作为非登录 shell 启动 bash(以便它会加载.bashrc),则可以省略它。
xterm在 Terminator 的配置中调用了一个选项(请参阅 参考资料man terminator_config),它应该设置TERM. 由于 错误,它不起作用,并且TERM始终设置为xterm。终结者还设置了一个COLORTERM变量 to gnome-terminal,因此您可以使用它来设置TERM为xterm-256color(因为gnome-terminal该值没有问题:
[[ $COLORTERM = gnome-terminal ]] && TERM=xterm-256color
Run Code Online (Sandbox Code Playgroud)
或者,我用来避免screen/问题的方法tmux:
[[ $COLORTERM = gnome-terminal && ! $TERM = screen-256color ]] && TERM=xterm-256color
Run Code Online (Sandbox Code Playgroud)
这是一个未经测试的想法:
/usr/share/applications/terminator.desktop到~/.local/share/applications