Skip to content

Instantly share code, notes, and snippets.

@numa08
Last active December 22, 2015 23:19

Revisions

  1. numa08 revised this gist Sep 13, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions change_pane_title.zsh
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,8 @@ ssh() {
    fi

    local remote=${${(P)#}%.*}
    local old_name="$HOST" #現在のペインのタイトルを取得する方法がわかりません>_<
    local renamed=0
    local old_name="$HOST" #現在のペインのタイトルを取得する方法がわかりません>_< しょうがないので、初期値のホスト名を指定
     local renamed=0

    if [[ $remote != -* ]]; then
    renamed=1
  2. numa08 created this gist Sep 13, 2013.
    21 changes: 21 additions & 0 deletions change_pane_title.zsh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # https://www.spatof.org/blog/tmux-ssh-rename-window.html
    ssh() {
    if [[ $# == 0 || -z $TMUX ]]; then
    command ssh $@
    fi

    local remote=${${(P)#}%.*}
    local old_name="$HOST" #現在のペインのタイトルを取得する方法がわかりません>_<
    local renamed=0

    if [[ $remote != -* ]]; then
    renamed=1
    #tmux rename-window $remote
    printf '\033]2;%s\033\\' "${remote}"
    fi
    command ssh $@
    if [[ $renamed == 1 ]];then
    #tmux rename-window "$old_name"
    printf '\033]2;%s\033\\' "${old_name}"
    fi
    }