我正在Fedora中将Fish和byobu与GNOME终端一起使用。我没有要求Fish更改终端名称。
cat〜/ .config / byobu / profile.tmux来源$ BYOBU_PREFIX / share / byobu / profiles / tmux设置-g status-right'#(gitmux -cfg〜/ .config / byobu / gitmux.conf)#{pane_current_path}'设置选项-g状态间隔1set-option -g设置标题set-option -g set-titles-string'#{?#{==:#{host},localhost},#{host_short}-:,}#{pane_current_path}#{pane_current_path}'设置允许重命名set-option -g allow-rename off
当我在cd
某个目录时,无论实际路径是什么,它将在更改为/home/psychoslave
之前短暂地更改终端标题。但是,一旦我运行一个程序,说yes
,标题就会回到正确的当前路径。
我该如何调整以始终在终端标题中显示当前Tmux窗格的目录?
请参阅https://github.com/fish-shell/fish-shell/issues/5699以获取更多信息。
#!/bin/sh
:<<:about:
Fix initial shell set up when opening a new a Tmux
This is intended to be used in combination with a Tmux configuration such as:
set-environment -g ENV $HOME/.config/byobu/enforce_user_shell.sh
set -g default-shell /bin/sh
set -g default-command $SHELL
NOTE: Fit ENV set up above to match the current script.
:about:
# If Tmux did `set -g default-shell /bin/sh`
[[ $SHELL = '/bin/sh' ]] || exit
# POSIX test for “$TERM starts with 'screen'”, matching "screen-256color" too
case "$TERM" in screen*) true ;; *) false ;; esac || exit
# Open a new tmux window, not impacted by the bug, at position 0 and exit
tmux move-window -s0 -t2 && tmux new-window -t0 && exit