unused, remove
[zsh.git] / .zsh / 00_Basics.zsh
1 # -*- mode: sh;-*-
2
3 # No core dumps
4 ulimit -c 0
5
6 local _umask
7 zstyle -s ':ganneff:config' umask _umask
8 _umask=${_umask:-022}
9 umask $_umask
10
11 # Want a halfway sane terminal
12 [[ -t 0 ]] && /bin/stty erase "^H" intr "^C" susp "^Z" dsusp "^Y" stop "^S" start "^Q" kill "^U" >& /dev/null
13
14 # watch for everybody but me
15 watch=(notme)
16 # check every 5 min for login/logout activity
17 LOGCHECK=300
18 WATCHFMT='%n %a %l from %m at %t.'
19
20 # autoload wrapper - use this one instead of autoload directly
21 # We need to define this function as early as this, because autoloading
22 # 'is-at-least()' needs it.
23 function zrcautoload() {
24 emulate -L zsh
25 setopt extended_glob
26 local fdir ffile
27 local -i ffound
28
29 ffile=$1
30 (( ffound = 0 ))
31 for fdir in ${fpath} ; do
32 [[ -e ${fdir}/${ffile} ]] && (( ffound = 1 ))
33 done
34
35 (( ffound == 0 )) && return 1
36 if [[ $ZSH_VERSION == 3.1.<6-> || $ZSH_VERSION == <4->* ]] ; then
37 autoload -U ${ffile} || return 1
38 else
39 autoload ${ffile} || return 1
40 fi
41 return 0
42 }
43
44 # Some things need to be done very early
45 # the following helper functions have been taken from the grml zshrc
46 # (wherever they got them from)
47 # check for version/system
48 # check for versions (compatibility reasons)
49 is4(){
50 [[ $ZSH_VERSION == <4->* ]] && return 0
51 return 1
52 }
53
54 is41(){
55 [[ $ZSH_VERSION == 4.<1->* || $ZSH_VERSION == <5->* ]] && return 0
56 return 1
57 }
58
59 is42(){
60 [[ $ZSH_VERSION == 4.<2->* || $ZSH_VERSION == <5->* ]] && return 0
61 return 1
62 }
63
64 is425(){
65 [[ $ZSH_VERSION == 4.2.<5->* || $ZSH_VERSION == 4.<3->* || $ZSH_VERSION == <5->* ]] && return 0
66 return 1
67 }
68
69 is43(){
70 [[ $ZSH_VERSION == 4.<3->* || $ZSH_VERSION == <5->* ]] && return 0
71 return 1
72 }
73
74 is433(){
75 [[ $ZSH_VERSION == 4.3.<3->* || $ZSH_VERSION == 4.<4->* \
76 || $ZSH_VERSION == <5->* ]] && return 0
77 return 1
78 }
79
80 is434(){
81 [[ $ZSH_VERSION == 4.3.<4->* || $ZSH_VERSION == 4.<4->* \
82 || $ZSH_VERSION == <5->* ]] && return 0
83 return 1
84 }
85
86 is435(){
87 [[ $ZSH_VERSION == 4.3.<5->* || $ZSH_VERSION == 4.<4->* \
88 || $ZSH_VERSION == <5->* ]] && return 0
89 return 1
90 }
91
92 is437(){
93 [[ $ZSH_VERSION == 4.3.<7->* || $ZSH_VERSION == 4.<4->* \
94 || $ZSH_VERSION == <5->* ]] && return 0
95 return 1
96 }
97
98 is439(){
99 [[ $ZSH_VERSION == 4.3.<9->* || $ZSH_VERSION == 4.<4->* \
100 || $ZSH_VERSION == <5->* ]] && return 0
101 return 1
102 }
103
104 isdarwin(){
105 [[ $OSNAME == Darwin* ]] && return 0
106 return 1
107 }
108
109 isfreebsd(){
110 [[ $OSNAME == FreeBSD* ]] && return 0
111 return 1
112 }
113
114 if ! [[ ${ZSH_VERSION} == 3.1.<7->* \
115 || ${ZSH_VERSION} == 3.<2->.<->* \
116 || ${ZSH_VERSION} == <4->.<->* ]] ; then
117
118 printf '-!-\n'
119 printf '-!- In this configuration we try to make use of features, that only\n'
120 printf '-!- require version 3.1.7 of the shell; That way this setup can be\n'
121 printf '-!- used with a wide range of zsh versions, while using fairly\n'
122 printf '-!- advanced features in all supported versions.\n'
123 printf '-!-\n'
124 printf '-!- However, you are running zsh version %s.\n' "$ZSH_VERSION"
125 printf '-!-\n'
126 printf '-!- While this *may* work, it might as well fail.\n'
127 printf '-!- Please consider updating to at least version 3.1.7 of zsh.\n'
128 printf '-!-\n'
129 printf '-!- DO NOT EXPECT THIS TO WORK FLAWLESSLY!\n'
130 printf '-!- If it does today, you'\''ve been lucky.\n'
131 printf '-!-\n'
132 printf '-!- Ye been warned!\n'
133 printf '-!-\n'
134
135 function zstyle() { : }
136 fi
137
138 for paths in "$fpath[@]"; do
139 for func in "$paths"/*(N:t); do
140 zrcautoload $func
141 done
142 done
143 unset paths