LoginSignup
37
38

More than 5 years have passed since last update.

tmuxでSSH時に変更したwindow-nameを自動でもとに戻す

Last updated at Posted at 2014-01-08

上記の記事の設定が便利ですが、コメントで @kawaz さんが指摘しているように、SSHを終了して戻ってきたときにwindow-nameが戻らないのが不便だったのでこんな感じの関数を登録しました。

.zshrc
function ssh() {
    local window_name=$(tmux display -p '#{window_name}')
    command ssh $@
    tmux rename-window $window_name
}

あとは通常通りの ssh コマンドを使えば自動でtmuxのwindow-nameが切り替わります。tmuxの外にいても特にエラーなどは発生しません。

37
38
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
37
38