allow extra files for settings
[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 # Load is-at-least() for more precise version checks Note that this test
44 # will *always* fail, if the is-at-least function could not be marked
45 # for autoloading. But is-at-least exists since Fri Feb 11 19:46:46 2000
46 # +0000, so if you really have an older zsh you really want to upgrade.
47 zrcautoload is-at-least || is-at-least() { return 1 }
48
49 # Some things need to be done very early
50 # the following helper functions have been taken from the grml zshrc
51 # (wherever they got them from)
52 # check for version/system
53 # check for versions (compatibility reasons)
54 is4(){
55 [[ $ZSH_VERSION == <4->* ]] && return 0
56 return 1
57 }
58
59 is41(){
60 [[ $ZSH_VERSION == 4.<1->* || $ZSH_VERSION == <5->* ]] && return 0
61 return 1
62 }
63
64 is42(){
65 [[ $ZSH_VERSION == 4.<2->* || $ZSH_VERSION == <5->* ]] && return 0
66 return 1
67 }
68
69 is425(){
70 [[ $ZSH_VERSION == 4.2.<5->* || $ZSH_VERSION == 4.<3->* || $ZSH_VERSION == <5->* ]] && return 0
71 return 1
72 }
73
74 is43(){
75 [[ $ZSH_VERSION == 4.<3->* || $ZSH_VERSION == <5->* ]] && return 0
76 return 1
77 }
78
79 is433(){
80 [[ $ZSH_VERSION == 4.3.<3->* || $ZSH_VERSION == 4.<4->* \
81 || $ZSH_VERSION == <5->* ]] && return 0
82 return 1
83 }
84
85 is434(){
86 [[ $ZSH_VERSION == 4.3.<4->* || $ZSH_VERSION == 4.<4->* \
87 || $ZSH_VERSION == <5->* ]] && return 0
88 return 1
89 }
90
91 is435(){
92 [[ $ZSH_VERSION == 4.3.<5->* || $ZSH_VERSION == 4.<4->* \
93 || $ZSH_VERSION == <5->* ]] && return 0
94 return 1
95 }
96
97 is437(){
98 [[ $ZSH_VERSION == 4.3.<7->* || $ZSH_VERSION == 4.<4->* \
99 || $ZSH_VERSION == <5->* ]] && return 0
100 return 1
101 }
102
103 is439(){
104 [[ $ZSH_VERSION == 4.3.<9->* || $ZSH_VERSION == 4.<4->* \
105 || $ZSH_VERSION == <5->* ]] && return 0
106 return 1
107 }
108
109 isdarwin(){
110 [[ $OSNAME == Darwin* ]] && return 0
111 return 1
112 }
113
114 isfreebsd(){
115 [[ $OSNAME == FreeBSD* ]] && return 0
116 return 1
117 }
118
119 if ! [[ ${ZSH_VERSION} == 3.1.<7->* \
120 || ${ZSH_VERSION} == 3.<2->.<->* \
121 || ${ZSH_VERSION} == <4->.<->* ]] ; then
122
123 printf '-!-\n'
124 printf '-!- In this configuration we try to make use of features, that only\n'
125 printf '-!- require version 3.1.7 of the shell; That way this setup can be\n'
126 printf '-!- used with a wide range of zsh versions, while using fairly\n'
127 printf '-!- advanced features in all supported versions.\n'
128 printf '-!-\n'
129 printf '-!- However, you are running zsh version %s.\n' "$ZSH_VERSION"
130 printf '-!-\n'
131 printf '-!- While this *may* work, it might as well fail.\n'
132 printf '-!- Please consider updating to at least version 3.1.7 of zsh.\n'
133 printf '-!-\n'
134 printf '-!- DO NOT EXPECT THIS TO WORK FLAWLESSLY!\n'
135 printf '-!- If it does today, you'\''ve been lucky.\n'
136 printf '-!-\n'
137 printf '-!- Ye been warned!\n'
138 printf '-!-\n'
139
140 function zstyle() { : }
141 fi
142
143 for paths in "$fpath[@]"; do
144 for func in "$paths"/*(N:t); do
145 zrcautoload $func
146 done
147 done
148 unset paths