-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment
448 lines (360 loc) · 11 KB
/
environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
if [ $NOISY ]; then
echo "reading ~/Library/init/zsh/environment"
fi
#$Id$
default_zsh_initdir=/Library/init/zsh
user_zsh_initdir=~/Library/init/zsh
if [ -r "${default_zsh_initdir}" ]; then
zsh_initdir="${default_zsh_initdir}"
else
zsh_initdir="${user_zsh_initdir}"
fi
zdotdir="${zsh_initdir}"
# define appendPath and prependPath to add directory paths, e.g. PATH, MANPATH.
# add to end of path
appendPath()
{
if eval test -z \"\$$1\" ; then
eval "$1=$2"
elif ! eval test -z "\"\${$1##*:$2:*}\"" -o -z "\"\${$1%%*:$2}\"" -o -z "\"\${$1##$2:*}\"" -o -z "\"\${$1##$2}\"" ; then
eval "$1=\$$1:$2"
fi
}
# add to front of path
prependPath()
{
if eval test -z \"\$$1\" ; then
eval "$1=$2"
elif ! eval test -z "\"\${$1##*:$2:*}\"" -o -z "\"\${$1%%*:$2}\"" -o -z "\"\${$1##$2:*}\"" -o -z "\"\${$1##$2}\"" ; then
eval "$1=$2:\$$1"
fi
}
prependPath PATH /usr/local/sbin
prependPath PATH /opt/local/bin
prependPath PATH ~/bin
prependPath PATH /usr/local/bin
prependPath PATH .
appendPath PATH /usr/bin
appendPath PATH /bin
appendPath PATH /usr/sbin
appendPath PATH /sbin
appendPath PATH /Developer/Tools
appendPath PATH /usr/local/mysql/bin
appendPath PATH /usr/local/mysql/lib
appendPath PATH /Library/Frameworks/Python.framework/Versions/2.7/bin
appendPath PATH /Users/dhoogest/bin
appendPath PATH /Users/dhoogest/src/org-export
export PATH
#PYTHONSTARTUP="${HOME}/.pythonrc.py"
#export PYTHONSTARTUP
EDITOR="edit -w"
export EDITOR
# prevents less from vanishing after q
LESS='-XRse'
export LESS
###########################
if [[ -o interactive ]]; then
function _exit() # function to run upon exit of shell
{
echo -e "[1;31mHasta la vista, baby![0m"
}
trap _exit 0
HISTSIZE=500
HISTFILE=~/.zsh_history
SAVEHIST=500
export HISTFILE HISTSIZE SAVEHIST
#---------------
# Shell prompt
#---------------
if [ -f "${zsh_initdir}"/prompt ]; then
. "${zsh_initdir}"/prompt
fi
# This alters the default behavior of the completion
# functions. If set to on, words which have more
# than one possible completion cause the matches to
# be listed immediately instead of ringing the bell.
#
#set show-all-if-ambiguous on
if [ -z $DISPLAY ]
then
DISPLAY=':0.0'
export DISPLAY
fi
compctl -D -f + -U -Q -K multicomp
# commented out by NH
#. "${zsh_initdir}"/compctl
# {{{ What version are we running?
if ! (( $+ZSH_VERSION_TYPE )); then
if [[ $ZSH_VERSION == 3.0.<->* ]]; then ZSH_STABLE_VERSION=yes; fi
if [[ $ZSH_VERSION == 3.1.<->* ]]; then ZSH_DEVEL_VERSION=yes; fi
ZSH_VERSION_TYPE=old
if [[ $ZSH_VERSION == 3.1.<6->* ||
$ZSH_VERSION == 3.<2->.<->* ||
$ZSH_VERSION == 4.<->* ]]
then
ZSH_VERSION_TYPE=new
fi
fi
# }}}
# {{{ Profiling
[[ -n "$ZSH_PROFILE_RC" ]] && which zmodload >&/dev/null && zmodload zsh/zprof
# }}}
# {{{ Loading status
zshrc_load_status () {
# \e[0K is clear to right
echo -n "\r.zshrc load: $* ... \e[0K"
}
# }}}
# {{{ Options
zshrc_load_status 'setting options'
setopt \
append_history \
auto_list \
auto_menu \
auto_param_keys \
NO_auto_pushd \
bad_pattern \
bang_hist \
brace_ccl \
correct_all \
cdable_vars \
NO_chase_links \
complete_in_word \
NO_csh_junkie_loops \
NO_csh_junkie_quotes \
NO_csh_null_glob \
extended_glob \
function_argzero \
glob \
NO_glob_assign \
glob_complete \
NO_glob_dots \
glob_subst \
hash_cmds \
hash_dirs \
hash_list_all \
hist_allow_clobber \
hist_beep \
NO_hup \
NO_ignore_braces \
ignore_eof \
interactive_comments \
NO_list_ambiguous \
list_types \
long_list_jobs \
magic_equal_subst \
NO_mark_dirs \
multios \
nomatch \
notify \
NO_null_glob \
path_dirs \
posix_builtins \
NO_print_exit_value \
pushd_ignore_dups \
NO_pushd_minus \
pushd_to_home \
rc_expand_param \
NO_rc_quotes \
NO_rm_star_silent \
NO_sh_file_expansion \
sh_word_split \
short_loops \
NO_single_line_zle \
NO_sun_keyboard_hack \
unset \
NO_verbose
# zle \
# NO_all_export \
# always_last_prompt \
# NO_always_to_end \
# NO_auto_cd \
# NO_auto_name_dirs \
# auto_param_slash \
# auto_remove_slash \
# NO_auto_resume \
# NO_beep \
# NO_bsd_echo \
# complete_aliases \
# NO_correct \
# csh_junkie_history \
# equals \
# extended_history \
# hist_ignore_dups \
# hist_ignore_space \
# NO_hist_no_store \
# hist_verify \
# NO_ignore_eof \
# NO_list_beep \
# NO_mail_warning \
# NO_menu_complete \
# numeric_glob_sort \
# NO_overstrike \
# NO_prompt_cr \
# prompt_subst \
# pushd_silent \
# sh_option_letters \
# NO_sh_word_split \
if [[ $ZSH_VERSION == 3.0.<6->* || $ZSH_VERSION_TYPE == 'new' ]]; then
setopt \
hist_reduce_blanks
fi
# }}}
# {{{ Watching for other users
LOGCHECK=60
WATCHFMT="[%B%t%b] %B%n%b has %a %B%l%b from %B%M%b"
# }}}
# {{{ Completions
zshrc_load_status 'completion system'
# {{{ New advanced completion system
if [[ "$ZSH_VERSION_TYPE" == 'new' ]]; then
autoload -U compinit
compinit -C # don't perform security check
else
print "\nAdvanced completion system not found; ignoring zstyle settings."
function zstyle { }
function compdef { }
# an antiquated, barebones completion system is better than nowt
which zmodload >&/dev/null && zmodload zsh/compctl
fi
##
## Enable the way cool bells and whistles.
##
# enable menu selection
# zstyle ':completion:*' menu select=6
# General completion technique
#zstyle ':completion:*' completer _complete _correct _approximate _prefix
zstyle ':completion:*' completer _complete _prefix
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:predict:*' completer _complete
# Completion caching
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
# Expand partial paths
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'
# Include non-hidden directories in globbed file completions
# for certain commands
#zstyle ':completion::complete:*' \
# tag-order 'globbed-files directories' all-files
#zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'
# Don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
# Separate matches into groups
zstyle ':completion:*:matches' group 'yes'
# Describe each match group.
zstyle ':completion:*:descriptions' format "%B---- %d%b"
# Messages/warnings format
zstyle ':completion:*:messages' format '%B%U---- %d%u%b'
zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b'
# Describe options in full
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
# }}}
# {{{ Simulate my old dabbrev-expand 3.0.5 patch
zstyle ':completion:*:history-words' stop yes
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false
zstyle ':completion:*:history-words' menu yes
# }}}
# {{{ Common hostnames
hosts=(
"$_etc_hosts[@]"
localhost
# ftp sites
sunsite.org.uk
developer.apple.com
)
zstyle ':completion:*' hosts $hosts
# }}}
# {{{ (host, port, user) triples for telnet
telnet_users_hosts_ports=(
)
zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
# }}}
# {{{ which
# reverse unwanted aliasing of `which' by distribution startup
# files (e.g. /etc/profile.d/which*.sh); zsh's which is perfectly
# good as is.
alias which >&/dev/null && unalias which
# }}}
# {{{ run-help
alias run-help >&/dev/null && unalias run-help
autoload run-help
# }}}
# {{{ zcalc
autoload zcalc
# }}}
# {{{ Restarting zsh or bash; reloading .zshrc or functions
bash () {
NO_SWITCH="yes" command bash "$@"
}
restart () {
exec $SHELL $SHELL_ARGS "$@"
}
profile () {
ZSH_PROFILE_RC=1 $SHELL "$@"
}
reload () {
if [[ "$#*" -eq 0 ]]; then
. $zdotdir/.zshrc
else
local fn
for fn in "$@"; do
unfunction $fn
autoload -U $fn
done
fi
}
compdef _functions reload
# }}}
# }}}
# {{{ Key bindings
zshrc_load_status 'key bindings'
bindkey '\e[A' up-line-or-history
bindkey '\e[B' down-line-or-history
bindkey -s '^X^Z' '%-^M'
bindkey '^[e' expand-cmd-path
#bindkey -s '^X?' '\eb=\ef\C-x*'
bindkey '^[^I' reverse-menu-complete
bindkey '^X^N' accept-and-infer-next-history
#bindkey '^[p' history-beginning-search-backward
#bindkey '^[n' history-beginning-search-forward
bindkey '^[P' history-beginning-search-backward
bindkey '^[N' history-beginning-search-forward
bindkey '^[b' emacs-backward-word
bindkey '^[f' emacs-forward-word
bindkey '^[v' expand-or-complete-prefix
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word
# Fix weird sequence that rxvt produces
bindkey -s '^[[Z' '\t'
# alias no=ls # for Dvorak
# }}}
# {{{ Miscellaneous
zshrc_load_status 'miscellaneous'
# {{{ ls colours
if which dircolors >&/dev/null && [[ -e "${zdotdir}/.dircolors" ]]; then
# show directories in yellow
eval `dircolors -b $zdotdir/.dircolors`
fi
if [[ $ZSH_VERSION > 3.1.5 ]]; then
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors \
'=(#b) #([0-9]#)*=0=01;31'
# completion colours
zstyle ':completion:*' list-colors "$LS_COLORS"
fi
#--------------- Completions added by NH
#------------------------------------------------------------------------------
# This from the iTerm website: http://iterm.sourceforge.net/resource.shtml
if [ "`uname`" = "Darwin" ]; then
compctl -f -x 'p[2]' -s "`/bin/ls -d1 /Applications/*/*.app /Applications/*.app | sed 's|^.*/\([^/]*\)\.app.*|\\1|;s/ /\\\\ /g'`" -- open
alias run='open -a'
fi
#------------------------------------------------------------------------------
# }}}
# }}}
fi