Tmux 不会停止自动重命名 windows
Tmux will not stop auto-renaming windows
我在使用 Tmux 时遇到的问题 - 在 .tmux.conf
文件中,我告诉他在设置名称后不要重命名 windows 但似乎不是 "respecting my authority" : ).
我的系统:
- OSX埃尔卡皮坦
- Tmux 2.1(通过 Brew 安装)
- Zshell
这是我的 ~/.tmux.conf 内容(抱歉太长了):
# set correct term
set -g default-terminal screen-256color
# set prefix key to ctrl+a
#unbind C-b
set -g prefix C-a
# reload config without killing server
bind R source-file /users/edchigliak/.tmux.conf
# enable wm window titles
set -g set-titles on
# disable auto renaming
set -g automatic-rename off
# border colour
set -g pane-border-fg blue
set -g pane-border-bg default
set -g pane-active-border-fg blue
set -g pane-active-border-bg default
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
set -g status-fg white
set -g status-bg default
# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr dim
# command/message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# Statusbar starting in X or not
# if '[ -n "$DISPLAY" ]' 'source-file ~/.tmux/inx'
# if '[ -z "$DISPLAY" ]' 'source-file ~/.tmux/xless'
如果我尝试:
~ > echo $TERM
我猜对了:
screen-256color
这让我相信它正在寻找正确的 .conf
文件。此外,控制键绑定确实从 Ctrl+b
更改为 Ctrl+a
。但是,我通过 Ctrl + a
然后 ,
更改的 window 名称将不会保留。
知道发生了什么事吗?谢谢!
一个可能的原因是,zsh 配置为在启动程序或发出提示时更新 window 标题。这是通过使用终端转义序列 \ek<TEXT>\e\
完成的,其中 <TEXT>
是 window 标题。
要防止这种情况,您有两个选择:
在 tmux 配置中不允许 window 重命名。
只需添加
set allow-rename off
给你的~/.tmux.conf
。这可以防止任何程序使用上述终端转义序列更改 window 标题。
找到您的 zsh 配置中的设置并禁用它。
如果你用的是oh-my-zsh,设置
应该就够了
DISABLE_AUTO_TITLE="true"
在你的 ~/.zshrc
中(或者只是取消注释,如果你使用 oh-my-zsh 中的默认 .zshrc
模板)。
如果您使用自己的配置或其他一些配置框架,您应该能够通过搜索 \ek
找到它(如果您的搜索工具需要它,请不要忘记引用反斜杠)。
对于 运行 bash 的人来说并登陆这个结果,设置标题的东西是 PROMPT_COMMAND
环境变量,一些共享系统恼人地设置了它。您可以使用 unset PROMPT_COMMAND
(例如在您的 .bashrc
)
为了让这对我有用,我必须将这一行添加到 ~/.tmux.conf
set-window-option -g allow-rename off
我在使用 Tmux 时遇到的问题 - 在 .tmux.conf
文件中,我告诉他在设置名称后不要重命名 windows 但似乎不是 "respecting my authority" : ).
我的系统:
- OSX埃尔卡皮坦
- Tmux 2.1(通过 Brew 安装)
- Zshell
这是我的 ~/.tmux.conf 内容(抱歉太长了):
# set correct term
set -g default-terminal screen-256color
# set prefix key to ctrl+a
#unbind C-b
set -g prefix C-a
# reload config without killing server
bind R source-file /users/edchigliak/.tmux.conf
# enable wm window titles
set -g set-titles on
# disable auto renaming
set -g automatic-rename off
# border colour
set -g pane-border-fg blue
set -g pane-border-bg default
set -g pane-active-border-fg blue
set -g pane-active-border-bg default
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
set -g status-fg white
set -g status-bg default
# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr dim
# command/message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# Statusbar starting in X or not
# if '[ -n "$DISPLAY" ]' 'source-file ~/.tmux/inx'
# if '[ -z "$DISPLAY" ]' 'source-file ~/.tmux/xless'
如果我尝试:
~ > echo $TERM
我猜对了:
screen-256color
这让我相信它正在寻找正确的 .conf
文件。此外,控制键绑定确实从 Ctrl+b
更改为 Ctrl+a
。但是,我通过 Ctrl + a
然后 ,
更改的 window 名称将不会保留。
知道发生了什么事吗?谢谢!
一个可能的原因是,zsh 配置为在启动程序或发出提示时更新 window 标题。这是通过使用终端转义序列 \ek<TEXT>\e\
完成的,其中 <TEXT>
是 window 标题。
要防止这种情况,您有两个选择:
在 tmux 配置中不允许 window 重命名。
只需添加
set allow-rename off
给你的
~/.tmux.conf
。这可以防止任何程序使用上述终端转义序列更改 window 标题。找到您的 zsh 配置中的设置并禁用它。
如果你用的是oh-my-zsh,设置
应该就够了DISABLE_AUTO_TITLE="true"
在你的
~/.zshrc
中(或者只是取消注释,如果你使用 oh-my-zsh 中的默认.zshrc
模板)。如果您使用自己的配置或其他一些配置框架,您应该能够通过搜索
\ek
找到它(如果您的搜索工具需要它,请不要忘记引用反斜杠)。
对于 运行 bash 的人来说并登陆这个结果,设置标题的东西是 PROMPT_COMMAND
环境变量,一些共享系统恼人地设置了它。您可以使用 unset PROMPT_COMMAND
(例如在您的 .bashrc
)
为了让这对我有用,我必须将这一行添加到 ~/.tmux.conf
set-window-option -g allow-rename off