zsh
This commit is contained in:
parent
cd0249c12f
commit
05ed36ac92
1 changed files with 4 additions and 9 deletions
|
|
@ -13,14 +13,11 @@ s() {
|
|||
|
||||
tmux rename-window "${ssh_host%%.*}" # short hostname
|
||||
|
||||
# Emit title update BEFORE ssh
|
||||
printf '\033k%s\033\\' "${ssh_host%%.*}"
|
||||
|
||||
# Run SSH session
|
||||
command ssh "$@"
|
||||
|
||||
# Restore after disconnect
|
||||
printf '\033k%s\033\\' "$original_name"
|
||||
# Restore previous tmux window name
|
||||
tmux rename-window "$original_name"
|
||||
else
|
||||
command ssh "$@"
|
||||
fi
|
||||
|
|
@ -36,14 +33,12 @@ sshr() {
|
|||
ssh_host="${ssh_host%%:*}"
|
||||
ssh_host="${ssh_host%% *}"
|
||||
|
||||
# Emit title update BEFORE ssh
|
||||
printf '\033k%s\033\\' "${ssh_host%%.*}"
|
||||
|
||||
# Set up trap to restore title even if interrupted
|
||||
trap 'printf "\033k%s\033\\n" "$original_name"' EXIT
|
||||
|
||||
command ssh "$@"
|
||||
|
||||
trap - EXIT # cleanup trap if ssh exited normally
|
||||
# Restore after disconnect
|
||||
printf '\033k%s\033\\' "$original_name"
|
||||
else
|
||||
command ssh "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue