diff zshrc @ 0:8b245298349a

zsh environment - initial import
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 28 Nov 2011 12:36:49 +0100
parents
children e12c50e8ea8c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,51 @@
+#
+# This is the main zshrc file.
+#
+
+if [ -d $HOME/.oh-my-zsh ]; then
+    . $HOME/.zsh-env/oh-my-zsh
+fi
+
+# get rid of some unwanted aliases from the oh-my-zsh env
+unalias l
+unalias lsa
+
+# custom function that should work on all platforms
+cd() { builtin cd "$@"; print -D $PWD; }
+ff() { find $2 -print0 | xargs -0 grep $1 }
+hgrep() { history | grep $* }
+mcd() { mkdir $1; cd $1 }
+psg() { ps auxww | grep -v grep | grep -i "$@" }
+
+# utility function that is used by various other modules
+removeFromPath() {
+    search_term="$1"
+    split_path=(${(s/:/)PATH})
+    clean_path=""
+    for element in ${split_path}
+    do
+        if [[ "${element}" =~ "${search_term}" ]]; then
+            continue
+        fi
+
+        if [ ${#clean_path} -eq 0 ]; then
+            clean_path="${element}"
+        else
+            clean_path="${clean_path}:${element}"
+        fi
+    done
+    echo "${clean_path}"
+}
+
+# include a zshrc per OS type
+local os_zshrc=$HOME/.zsh-env/zshrc-$OSTYPE
+if [ -f ${os_zshrc} ]; then
+    . ${os_zshrc}
+fi
+
+# include a zshrc per host
+local hostname=`uname -n`
+local host_zshrc=$HOME/.zsh-env/zshrc-${hostname}
+if [ -r ${host_zshrc} ]; then
+    . ${host_zshrc}
+fi