From 8debd097fbea09032c27b2c8d69d8430d7ea0551 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 07:43:36 -0700 Subject: Moving all zsh config options into a lib/ subdirectory to make way for some upcoming changes to directory structure and configuration options --- lib/functions.zsh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 lib/functions.zsh (limited to 'lib/functions.zsh') diff --git a/lib/functions.zsh b/lib/functions.zsh new file mode 100644 index 000000000..e3891f6fc --- /dev/null +++ b/lib/functions.zsh @@ -0,0 +1,59 @@ +function title { + if [[ $TERM == "screen" ]]; then + # Use these two for GNU Screen: + print -nR $'\033k'$1$'\033'\\\ + + print -nR $'\033]0;'$2$'\a' + elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then + # Use this one instead for XTerms: + print -nR $'\033]0;'$*$'\a' + fi +} + +function precmd { + title zsh "$PWD" +} + +function preexec { + emulate -L zsh + local -a cmd; cmd=(${(z)1}) + title $cmd[1]:t "$cmd[2,-1]" +} + +function remote_console() { + /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" +} + +function zsh_stats() { + history | awk '{print $2}' | sort | uniq -c | sort -rn | head +} + +function uninstall_oh_my_zsh() { + /bin/sh $ZSH/tools/uninstall.sh +} + +function upgrade_oh_my_zsh() { + /bin/sh $ZSH/tools/upgrade.sh +} + +function tab() { + osascript 2>/dev/null <