我连接到远程计算机ssh
并在远程计算机上启动byobu
会话。每当我在 byobu 窗口中更改目录时,窗口都会重命名为username@remote-pc:~/.../.../...
. 当我使用该名称重命名窗口时,F8
将持续到下一个cd
.
我怎样才能防止这种情况?
我在 Fedora 上遇到了同样的问题。
在每个 bash 会话中,PROMPT_COMMAND
默认设置/etc/bashrc
为__vte_prompt_command
man bash
说
PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each primary prompt.
__vte_prompt_command
定义在/etc/profile.d/vte.sh
type __vte_prompt_command
给
__vte_prompt_command is a function
__vte_prompt_command ()
{
local pwd='~';
[ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/};
printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
}
为防止这种情况,您可以unset PROMPT_COMMAND
在采购后/etc/bashrc
添加~/.bashrc
您可能还想仅在 byobu 会话中执行此操作,您可以为此测试 byobu 环境变量(BYOBU_RUN_DIR
?)
此答案适用于 zsh 用户。
我现在用 zsh 发生过两次这种情况。令人沮丧。在这里发帖,以便我可以在未来寻找解决方案(并希望能帮助任何其他迷失的灵魂)。
在~/.zshrc
你会发现
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
取消注释,DISABLE_AUTO_TITLE="true"
所以它看起来像
# Uncomment the following line to disable auto-setting terminal title.
DISABLE_AUTO_TITLE="true"
别担心,未来的我
使用 tmux 时,您可以通过添加以下内容来防止任何程序重命名窗口~/.byobu/.tmux.conf
:
set-option -g allow-rename off