title.zsh 232 B

1234567891011121314
  1. function set_title () {
  2. printf '%s%s%s' $'\e]0;' "$@" $'\a'
  3. }
  4. case $TERM in
  5. (xterm*|rxvt*)
  6. precmd () {
  7. set_title ${(%):-"%n@%m: %~"}
  8. }
  9. preexec () {
  10. set_title "${(%):-"%n@%m: "}" "$1"
  11. }
  12. ;;
  13. esac