Mercurial > hg > zsh-env
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8b245298349a |
---|---|
1 # | |
2 # This is the main zshrc file. | |
3 # | |
4 | |
5 if [ -d $HOME/.oh-my-zsh ]; then | |
6 . $HOME/.zsh-env/oh-my-zsh | |
7 fi | |
8 | |
9 # get rid of some unwanted aliases from the oh-my-zsh env | |
10 unalias l | |
11 unalias lsa | |
12 | |
13 # custom function that should work on all platforms | |
14 cd() { builtin cd "$@"; print -D $PWD; } | |
15 ff() { find $2 -print0 | xargs -0 grep $1 } | |
16 hgrep() { history | grep $* } | |
17 mcd() { mkdir $1; cd $1 } | |
18 psg() { ps auxww | grep -v grep | grep -i "$@" } | |
19 | |
20 # utility function that is used by various other modules | |
21 removeFromPath() { | |
22 search_term="$1" | |
23 split_path=(${(s/:/)PATH}) | |
24 clean_path="" | |
25 for element in ${split_path} | |
26 do | |
27 if [[ "${element}" =~ "${search_term}" ]]; then | |
28 continue | |
29 fi | |
30 | |
31 if [ ${#clean_path} -eq 0 ]; then | |
32 clean_path="${element}" | |
33 else | |
34 clean_path="${clean_path}:${element}" | |
35 fi | |
36 done | |
37 echo "${clean_path}" | |
38 } | |
39 | |
40 # include a zshrc per OS type | |
41 local os_zshrc=$HOME/.zsh-env/zshrc-$OSTYPE | |
42 if [ -f ${os_zshrc} ]; then | |
43 . ${os_zshrc} | |
44 fi | |
45 | |
46 # include a zshrc per host | |
47 local hostname=`uname -n` | |
48 local host_zshrc=$HOME/.zsh-env/zshrc-${hostname} | |
49 if [ -r ${host_zshrc} ]; then | |
50 . ${host_zshrc} | |
51 fi |