如何阻止 zsh (oh-my-zsh) 重置屏幕窗口标题?

vfc*_*sts 2 gnu-screen zsh oh-my-zsh

每当我在其中创建一个新窗口时,gnu screen我通常会给它一个在断开连接之间持续存在的名称,但我注意到当我在窗口中运行命令时,标题的oh-my-zsh分布zsh会被重置。基本上,它被复位到(x* ~)哪里x是窗口数量。

不仅如此,当我在该窗口的远程会话中运行命令时,如果远程 shell 是zsh. 这不会发生在bash.

例如,假设我在屏幕中创建了一个标题为 as 的新窗口(2* ~),然后将标题设置为user@remotehost因为我要连接到remotehostas user。当我跑去ssh user@remotehost连接时remotehost,标题恢复为(2* ~). 当remotehost我运行我不想要htop的标题更改时htop

zsh即使它连接到另一个会话,它似乎也正在将远程窗口命令传播到本地窗口的标题中。这似乎只zsh发生在bash. 是否有一些设置 zshoh-my-zsh覆盖了以前的行为?我没有改变,.screenrc切换到zsh这里。

# got a fancy hardstatus line noted below
hardstatus on
hardstatus alwayslastline
# hardstatus string "%w"

# blagged this hardstatus like from https://bbs.archlinux.org/viewtopic.php?id=55618, not quite sure what it does
# extended from http://unix.stackexchange.com/questions/195209 and , uptime command disabled
# http://www.gnu.org/software/screen/manual/html_node/String-Escapes.html#String-Escapes
hardstatus string '%{= kG}%{C}Screen:%{Rk}Host:%H %1`%{c}%{= kG}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{C} %d-%m %{W}%c %{g}]'
backtick 1 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*" | cut -d '.' -f 2'
# backtick 2 60 60 /usr/bin/uptime
Run Code Online (Sandbox Code Playgroud)

vfc*_*sts 6

可以.zshrc通过取消注释行来禁用它:

# Uncomment the following line to disable auto-setting terminal title. 
# DISABLE_AUTO_TITLE="true"
Run Code Online (Sandbox Code Playgroud)

它应用于函数omz_termsupport_precmdomz_termsupport_preexec,它们在~/.oh-my-zsh/lib/termsupport.zsh