3

ウィンドウのタイトル バーに PWD を表示したい。私の.bashrc中には、Bashのトリックを行うように見えるこれがあります:

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

ただし、Tmux を使用すると、Tmux 内で移動した現在のディレクトリではなく、Tmux を起動したディレクトリがウィンドウに表示されます。

以下では、 で Tmux を起動し~、 に移動し~/Downloadsます。タイトル バーは引き続き表示されます~~/Downloadsその背後には、 Bash だけを使用してナビゲートするウィンドウがあります。それは私が欲しいものを示しています: ここに画像の説明を入力

うまくいかなかった私がすでに試したことは次のとおりです。

4

1 に答える 1

4

他の変更と組み合わせる前にこれを試したときだと思います...今は動作します:

~/.tmux.conf:

set -g set-titles on
set -g set-titles-string '#T'

で(ちなみに、switchステートメント~/.bashrcに追加しました):|screen

if [ "$color_prompt" = yes ]; then
    PS1='> '
    #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|screen)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac
于 2014-02-06T17:56:14.690 に答える