-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.zshenv
174 lines (156 loc) · 4.33 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
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
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# http://qiita.com/scalper/items/86da115e6c76a692d687
if [[ -n $ZPROF ]]; then
zmodload zsh/zprof && zprof
fi
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ $SHLVL -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi
# my setting
# do not register duplicated paths
typeset -U path cdpath fpath manpath
typeset -x H
H=${H:-$HOME}
path=
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
else
path=(
/usr{/local,}/bin
/bin
{/usr,}/sbin
/opt/X11/bin
)
fi
path=(
$HOME/bin(N-/)
$HOME/git/dotfiles/bin(N-/)
$HOME/.ghg/bin(N-/)
$path)
# for python
if (( $+commands[pyenv] )); then
eval "$(pyenv init - --no-rehash zsh)"
elif (( $+commands[python3.7] )); then
if ! (( $+commands[python3] )); then
mkdir -p $HOME/bin
ln -s $(which python3.7) $HOME/bin/python3
fi
if ! (( $+commands[pip3] )); then
mkdir -p $HOME/bin
ln -s $(which pip3.7) $HOME/bin/pip3
fi
else
typeset -xT PYENV_ROOT pyenv_root
pyenv_root=$HOME/.pyenv
path=($pyenv_root/bin(N-/) $path)
if [[ -x $pyenv_root/bin/pyenv ]]; then eval "$(pyenv init - --no-rehash zsh)"; fi
fi
if [[ $OSTYPE == darwin* ]]; then
path=($HOME/Library/Python/{3.7,2.7}/bin(N-/) $path)
else
path=($HOME/.local/bin(N-/) $path)
fi
typeset -xTU PYTHONPATH pythonpath
typeset -xTU MYPYPATH mypypath
pythonpath+=(
$HOME/.cache/dein/repos/github.com/Shougo/defx.nvim/rplugin/python3(N-/)
$HOME/.cache/dein/repos/github.com/Shougo/denite.nvim/rplugin/python3(N-/)
$HOME/.cache/dein/repos/github.com/Shougo/deol.nvim/rplugin/python3(N-/)
$HOME/.cache/dein/repos/github.com/Shougo/deoplete.nvim/rplugin/python3(N-/)
/usr/local/Cellar/fontforge/*/lib/python3.7/site-packages(N-/)
)
MYPYPATH=$PYTHONPATH
# for ruby
path=($HOME/.gem/ruby/2.6.0/bin(N-/) $path)
if (( $+commands[rbenv] )); then
eval "$(rbenv init - --no-rehash zsh)"
elif [[ -x /usr/local/opt/ruby/bin/ruby ]]; then
path=(/usr/local/opt/ruby/bin(N-/) $path)
else
typeset -xT RBENV_ROOT rbenv_root
rbenv_root=$HOME/.rbenv
path=($rbenv_root/bin(N-/) $path)
if [[ -x $rbenv_root/bin/rbenv ]]; then eval "$(rbenv init - --no-rehash zsh)"; fi
fi
# for lua
if (( $+commands[luaenv] )); then
eval "$(luaenv init - --no-rehash zsh)"
else
typeset -xT LUAENV_ROOT luaenv_root
luaenv_root=$HOME/.luaenv
path=($luaenv_root/bin(N-/) $path)
if [ -x $luaenv_root/bin/luaenv ]; then eval "$(luaenv init -)"; fi
fi
# perl
if [[ -d $HOME/perl5 ]]; then
if [[ $OSTYPE == darwin* ]]; then
arch=darwin-2level
fi
typeset -xTU PERL5LIB perl5lib
path=($HOME/perl5/bin(N-/) $path)
perl5lib+=(
$HOME/perl5/lib/perl5(N-/)
$HOME/perl5/lib/perl5/$arch/auto(N-/)
)
fi
# for plenv
alias perl='perl -I$HOME/perl5/lib/perl5'
if (( $+commands[plenv] )); then
eval "$(plenv init - zsh)"
elif [[ -x /usr/local/opt/perl/bin/perl ]]; then
path=(/usr/local/opt/perl/bin(N-/) $path)
else
typeset -xT PLENV_ROOT plenv_root
plenv_root=$HOME/.plenv
path=($plenv_root/bin(N-/) $path)
if [[ -x $plenv_root/bin/plenv ]]; then eval "$(plenv init - --no-rehash zsh)"; fi
fi
# for go
typeset -xT GO111MODULE go111module
go111module=on
typeset -xT GOPATH gopath
gopath=$HOME/.go
path=($gopath/bin(N-/) $path)
if (( $+commands[goenv] )); then
export GOENV_GOPATH_PREFIX=$gopath
eval "$(goenv init - --no-rehash zsh)"
else
typeset -xT GOENV_ROOT goenv_root
goenv_root=$HOME/.goenv
path=($goenv_root/bin(N-/) $path)
if [[ -x $goenv_root/bin/goenv ]]; then eval "$(goenv init - --no-rehash zsh)"; fi
fi
# for Node.js
if (( $+commands[nodenv] )); then
eval "$(nodenv init - --no-rehash zsh)"
elif [[ -f /usr/local/opt/nvm/nvm.sh ]]; then
typeset -xT NVM_DIR nvm_dir
nvm_dir=$HOME/.nvm
mkdir -p $nvm_dir
# https://qiita.com/uasi/items/80865646607b966aedc8
# pseudo nvm() to delay initialization until nvm() is executed
nvm() {
source /usr/local/opt/nvm/nvm.sh
nvm "$@"
}
fi
# for hub
if (( $+commands[hub] )); then
alias git=hub
fi
# for Rust
if [[ -d $HOME/.cargo/bin ]]; then
path=($HOME/.cargo/bin $path)
fi
# home usr directory
path=($HOME/usr{/local,}/bin(N-/) $path)
typeset -xT ZSHENV_LOADED zshenv_loaded
typeset -xT PATH_IN_ZSHENV path_in_zshenv
zshenv_loaded=1
path_in_zshenv=$PATH