From f4bf8402b2b41558586d25a65e3a4012fff8a11a Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Sun, 22 Aug 2021 15:37:15 +0500 Subject: [PATCH] Add ssh wrapper which able to set local TMUX window name without crutches on remote side. --- zsh/aliases/50-ssh.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 zsh/aliases/50-ssh.conf diff --git a/zsh/aliases/50-ssh.conf b/zsh/aliases/50-ssh.conf new file mode 100644 index 0000000..6d91471 --- /dev/null +++ b/zsh/aliases/50-ssh.conf @@ -0,0 +1,11 @@ +# Found at https://www.reddit.com/r/tmux/comments/nyjjwy/add_hostname_of_remote_server_in_status_bar/ +# and modified to set also "ssh" prefix. +ssh() { + if [ -n "$TMUX" ]; then + tmux -2u rename-window "ssh $(echo $* | rev | cut -d '@' -f1 | rev)"; + command ssh "$@"; + tmux -2u set-window-option automatic-rename "on" > /dev/null; + else + command ssh "$@"; + fi +}