zsh title: show host only on ssh

This commit is contained in:
Mathieu Maret 2019-10-22 11:41:38 +02:00
parent 688a4b5eda
commit 8944348eee

View File

@ -25,17 +25,37 @@
case $TERM in case $TERM in
*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term) *xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
precmd () { print -Pn "\e]0;[%n@%M][%~]%#\a" } precmd () {
preexec () { print -Pn "\e]0;[%n@%M][%~]%# ($1)\a" } if [[ -v SSH_CONNECTION ]]; then
print -Pn "\e]0;[%n@%M][%~]#\a"
else
print -Pn "\e]0;[%~]#\a"
fi
}
preexec () {
if [[ -v SSH_CONNECTION ]]; then
print -Pn "\e]0;[%n@%M][%~]# ($1)\a"
else
print -Pn "\e]0;[%~]# ($1)\a"
fi
}
;; ;;
screen) screen)
precmd () { precmd () {
print -Pn "\e]83;title \"$1\"\a" print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a" if [[ -v SSH_CONNECTION ]]; then
print -Pn "\e]0;$TERM - (%L) [%n@%M]# [%~]\a"
else
print -Pn "\e]0;$TERM - (%L)# [%~]\a"
fi
} }
preexec () { preexec () {
print -Pn "\e]83;title \"$1\"\a" print -Pn "\e]83;title \"$1\"\a"
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a" if [[ -v SSH_CONNECTION ]]; then
print -Pn "\e]0;$TERM - (%L) [%n@%M]# [%~] ($1)\a"
else
print -Pn "\e]0;$TERM - (%L) # [%~] ($1)\a"
fi
} }
;; ;;
esac esac