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