termsupport.zsh 429 B

123456789101112131415161718192021
  1. case "$TERM" in
  2. xterm*|rxvt*)
  3. preexec () {
  4. print -Pn "\e]0;%n@%m: $1\a" # xterm
  5. }
  6. precmd () {
  7. print -Pn "\e]0;%n@%m: %~\a" # xterm
  8. }
  9. ;;
  10. screen*)
  11. preexec () {
  12. local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
  13. echo -ne "\ek$CMD\e\\"
  14. print -Pn "\e]0;%n@%m: $1\a" # xterm
  15. }
  16. precmd () {
  17. echo -ne "\ekzsh\e\\"
  18. print -Pn "\e]0;%n@%m: %~\a" # xterm
  19. }
  20. ;;
  21. esac