functions.zsh 744 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ## fixme, i duplicated this in xterms - oops
  2. function title {
  3. if [[ $TERM == "screen" ]]; then
  4. # Use these two for GNU Screen:
  5. print -nR $'\033k'$1$'\033'\\\
  6. print -nR $'\033]0;'$2$'\a'
  7. elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
  8. # Use this one instead for XTerms:
  9. print -nR $'\033]0;'$*$'\a'
  10. fi
  11. }
  12. function precmd {
  13. title zsh "$PWD"
  14. }
  15. function preexec {
  16. emulate -L zsh
  17. local -a cmd; cmd=(${(z)1})
  18. title $cmd[1]:t "$cmd[2,-1]"
  19. }
  20. function zsh_stats() {
  21. history | awk '{print $2}' | sort | uniq -c | sort -rn | head
  22. }
  23. function uninstall_oh_my_zsh() {
  24. /bin/sh $ZSH/tools/uninstall.sh
  25. }
  26. function upgrade_oh_my_zsh() {
  27. /bin/sh $ZSH/tools/upgrade.sh
  28. }
  29. function take() {
  30. mkdir -p $1
  31. cd $1
  32. }