Add ssh wrapper which able to set local TMUX window name without crutches on remote side.

This commit is contained in:
Stanislav Nikitin 2021-08-22 15:37:15 +05:00
parent 14d6126c4c
commit f4bf8402b2
Signed by: pztrn
GPG Key ID: 1E944A0F0568B550
1 changed files with 11 additions and 0 deletions

11
zsh/aliases/50-ssh.conf Normal file
View File

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