-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.zshenv
121 lines (88 loc) · 2.78 KB
/
.zshenv
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
#!/bin/zsh
#
# .zshenv
# for zsh 3.1.6 and newer (may work OK with earlier versions)
#
# by Adam Spiers <[email protected]>
#
# Best viewed in emacs folding mode (folding.el).
# (That's what all the # {{{ and # }}} are for.)
#
# This gets run even for non-interactive shells;
# keep it as fast as possible.
#
# N.B. This is for zsh-specific environment stuff. Put generic,
# portable environment settings in .shared_env instead, so that they
# take effect for bash and ksh.
# Allow disabling of entire environment suite
[ -n "$INHERIT_ENV" ] && return 0
# Stop bad system-wide scripts interfering.
setopt NO_global_rcs
# {{{ What version are we running?
shell=zsh
ZSH_VERSION_TYPE=new
# }}}
# {{{ zdotdir
# ZDOTDIR is a zsh-ism but it's a good concept so we generalize it to
# the other shells.
# This allows us to have a good set of .*rc files etc. in one place
# and to be able to reuse that from a different account (e.g. root).
# We have to do some of this both here and in .shared_env to avoid
# a chicken and egg thing when looking for the right .shared_env.
zdotdir=${ZDOTDIR:-$HOME}
export ZDOTDIR="$zdotdir"
# }}}
[[ -e $zdotdir/.shared_env ]] && . $zdotdir/.shared_env
sh_load_status ".zshenv already started before .shared_env"
setopt extended_glob
sh_load_status "search paths"
# {{{ prevent duplicates in path variables
# path and manpath are special - "hardcoded" tie with $(MAN)PATH
typeset -U path
typeset -U manpath
export MANPATH
typeset -TU LD_LIBRARY_PATH ld_library_path
typeset -TU PERL5LIB perl5lib
# }}}
# {{{ Ruby libraries
typeset -TU RUBYLIB rubylib
export RUBYLIB
rubylib=(
~/lib/[r]uby{/site_ruby,}{/1.*,}{/i?86*,}(N)
~/lib/[r]uby(N)
$rubylib
)
# }}}
# {{{ Python libraries
typeset -TU PYTHONPATH pythonpath
export PYTHONPATH
# }}}
# {{{ fpath/autoloads
sh_load_status "fpath/autoloads"
typeset -U fpath
fpath=(
{~,$zdotdir}/.[z]sh/$ZSH_VERSION/*.zwc(N)
{~,$zdotdir}/{.[z]sh,[l]ib/zsh}/{functions{,/person-$ZDOTUSER,/host-${HOST%%.*}},scripts}(N)
/etc/zsh_completion.d
$fpath
)
# Autoload shell functions from all directories in $fpath. Restrict
# functions from $zdotdir/.zsh to ones that have the executable bit
# on. (The executable bit is not necessary, but gives you an easy way
# to stop the autoloading of a particular shell function).
#
# The ':t' is a history modifier to produce the tail of the file only,
# i.e. dropping the directory path. The 'x' glob qualifier means
# executable by the owner (which might not be the same as the current
# user).
for dirname in $fpath; do
case "$dirname" in
$zdotdir/.zsh*) fns=( $dirname/*~*~(-N.x:t) ) ;;
*) fns=( $dirname/*~*~(-N.:t) ) ;;
esac
(( $#fns )) && autoload "$fns[@]"
done
# }}}
# {{{ Specific to hosts
run_hooks .zshenv.d
# }}}