[英]Color scheme of a nested terminal, tmux, ssh, vim setup
在我的本地计算机上,iterm终端包含tmux。 在tmux里面,有ssh远程连接。 在这个远程连接中,我在服务器端运行tmux。 在那个tmux中,我运行vim。
所以,容器关系如下:首先是iterm,然后是tmux,然后是ssh远程连接,然后是tmux,然后是vim。
现在,vim的颜色是如何确定的? 哪种应用有效的配色方案?
您看到的颜色很好地受到终端仿真器的“物理”功能的限制,但它们的数量通常由TERM
环境变量改变,程序使用它来确定它们在着色中的可能性。
用简单的术语......
当Vim检查你的TERM
并看到一个包含256
的值时,它假定你的终端仿真器能够显示256种颜色并相应地动作。
当您的TERM
是xterm
或screen
(以及其他)时,Vim假定您的终端仿真器只能显示8种颜色并相应地采取行动。
假设您在本地终端仿真器中的当前TERM
是xterm-256color
并且没有中间*rc
设置特定的TERM
:
WHERE TERM COLORS
--------------------------------------------------------------
local xterm-256color 256
local > vim xterm-256color 256
local > remote xterm-256color 256
local > remote > vim xterm-256color 256
local > remote > remote > remote > remote > remote > remote >
> remote > remote > remote > remote xterm-256color 256
local > remote > tmux screen 8
local > remote > tmux > vim screen 8
local > tmux screen 8
local > tmux > vim screen 8
local > tmux > remote screen 8
local > tmux > remote > tmux screen 8
local > tmux > remote > tmux > vim screen 8
Tmux作为终端多路复用器,就好像它是一个终端仿真器,并将你的TERM
更改为tmux的默认值, screen
,并且新值是沿链传递的值。
如果你想在任何地方使用tmux 和奇特的颜色,你需要配置每个tmux使用256色准备好的TERM
。 在您登录的每台计算机上将此行放在~/.tmux.conf
中,包括您的:
set-option -g default-terminal "screen-256color"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.