0

我在带有 GNOME 终端的 Fedora 中使用 Fish 和 byobu。我没有要求 Fish 更改终端标题。

cat ~/.config/byobu/profile.tmux source $BYOBU_PREFIX/share/byobu/profiles/tmux set -g status-right '#(gitmux -cfg ~/.config/byobu/gitmux.conf) #{pane_current_path}' set-option -g status-interval 1 set-option -g set-titles on set-option -g set-titles-string '#{?#{==:#{host},localhost},#{host_short} - :,}#{pane_current_path}#{pane_current_path}' 设置允许重命名关闭设置选项 -g 允许重命名关闭

当我进入某个目录时,无论实际路径是什么cd,它都会在将其更改为之前按预期短暂更改终端标题。/home/psychoslave但是,一旦我运行一个程序,例如yes,标题就会回到正确的当前路径。

我可以调整什么以始终在终端标题中显示当前 Tmux 窗格的目录?

4

1 回答 1

0

有关更多信息,请参阅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
于 2020-05-20T01:03:03.247 回答