functions.zsh 528 B

1234567891011121314151617181920212223242526
  1. function title {
  2. if [[ $TERM == "screen" ]]; then
  3. # Use these two for GNU Screen:
  4. print -nR $'\033k'$1$'\033'\\\
  5. print -nR $'\033]0;'$2$'\a'
  6. elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
  7. # Use this one instead for XTerms:
  8. print -nR $'\033]0;'$*$'\a'
  9. fi
  10. }
  11. function precmd {
  12. title zsh "$PWD"
  13. }
  14. function preexec {
  15. emulate -L zsh
  16. local -a cmd; cmd=(${(z)1})
  17. title $cmd[1]:t "$cmd[2,-1]"
  18. }
  19. function remote_console() {
  20. /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
  21. }