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 +}