Mercurial > hg > zsh-env
annotate zshrc @ 9:7364a3399187
do not save history to avoid cross-shell history
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 01 Dec 2011 09:18:41 +0100 |
parents | db85a076d8ae |
children | 6c4ab833e66d |
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 |
6 | 6 ZSH=$HOME/.oh-my-zsh |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
7 . $HOME/.zsh-env/oh-my-zsh |
3
d31291a406ed
look for oh-my-zsh in a system wide folder
Dirk Olmes <dirk.olmes@exentra.de>
parents:
1
diff
changeset
|
8 elif [ -d /var/lib/zsh/oh-my-zsh ]; then |
6 | 9 ZSH=/var/lib/zsh/oh-my-zsh |
10 . $HOME/.zsh-env/oh-my-zsh | |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
11 fi |
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 # 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
|
14 unalias l |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
15 unalias lsa |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
16 |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
17 # custom function that should work on all platforms |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
18 cd() { builtin cd "$@"; print -D $PWD; } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
19 ff() { find $2 -print0 | xargs -0 grep $1 } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
20 hgrep() { history | grep $* } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
21 mcd() { mkdir $1; cd $1 } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
22 psg() { ps auxww | grep -v grep | grep -i "$@" } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
23 |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
24 # utility function that is used by various other modules |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
25 removeFromPath() { |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
26 search_term="$1" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
27 split_path=(${(s/:/)PATH}) |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
28 clean_path="" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
29 for element in ${split_path} |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
30 do |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
31 if [[ "${element}" =~ "${search_term}" ]]; then |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
32 continue |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
33 fi |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
34 |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
35 if [ ${#clean_path} -eq 0 ]; then |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
36 clean_path="${element}" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
37 else |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
38 clean_path="${clean_path}:${element}" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
39 fi |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
40 done |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
41 echo "${clean_path}" |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
42 } |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
43 |
9
7364a3399187
do not save history to avoid cross-shell history
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
8
diff
changeset
|
44 # no history handling for now ... or find a better way to save history per shell not across all shells |
7364a3399187
do not save history to avoid cross-shell history
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
8
diff
changeset
|
45 export HISTFILE= |
7364a3399187
do not save history to avoid cross-shell history
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
8
diff
changeset
|
46 |
7
4263bbc594fe
re-declare $HOST to be hostname only
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
3
diff
changeset
|
47 # $HOST can either be just the host name or the FQDN. Standardize on the raw host name |
4263bbc594fe
re-declare $HOST to be hostname only
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
3
diff
changeset
|
48 export HOST=`echo $HOST | awk -F '.' '{ print $1 }'` |
4263bbc594fe
re-declare $HOST to be hostname only
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
3
diff
changeset
|
49 |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
50 # include a zshrc per OS type |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
51 local os_zshrc=$HOME/.zsh-env/zshrc-$OSTYPE |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
52 if [ -f ${os_zshrc} ]; then |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
53 . ${os_zshrc} |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
54 fi |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
55 |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
56 # include a zshrc per host |
1
e12c50e8ea8c
use the builtin HOST variable
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
0
diff
changeset
|
57 local host_zshrc=$HOME/.zsh-env/zshrc-${HOST} |
0
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
58 if [ -r ${host_zshrc} ]; then |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
59 . ${host_zshrc} |
8b245298349a
zsh environment - initial import
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
60 fi |