-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshenv
69 lines (53 loc) · 1.29 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
# Common Stuff
export DEN="$(dirname "$(dirname "${0:h:A}")")"
export HOME_ETC="$DEN/etc"
export HOME_OPT="$HOME/opt"
export HOME_TMP="$HOME/tmp"
export HOME_SHARE="$DEN/share"
export HOME_VAR="$HOME/var"
export HISTORY="$HOME_VAR/history"
export CACHE_DIR="$HOME_VAR/cache"
export ZSH_CACHE_DIR="$CACHE_DIR/zsh"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$CACHE_DIR"
export XDG_DATA_HOME="$HOME_VAR"
export XDG_STATE_HOME="$HOME_VAR/state"
###
# Paths
#
# Need to be set in environment because scripts don't load rc.
# Scripts may run commands using these paths.
# Go
export GO_PATH="$HOME_OPT/go"
export GOPATH="$GO_PATH"
# Node
export NPM_PATH="$HOME_OPT/npm"
export NPM_CONFIG_CACHE="$NPM_PATH/cache"
# Rust
export CARGO_HOME="$HOME_OPT/cargo"
# Ruby
export GEM_PATH="$HOME_OPT/gem/ruby/2.6.0"
# Dart
export DART_PUB_PATH="$HOME_OPT/pub-cache"
export PUB_CACHE="$DART_PUB_PATH"
export HOME_LOCAL="$HOME/.local"
# We need some paths. Let us have paths
# reverse order so the bottom ends up at the front of $PATH
paths=(
HOME_LOCAL
DART_PUB_PATH
GEM_PATH
NPM_PATH
CARGO_HOME
GO_PATH
DEN
HOME
)
# Export our path paths in the PATH
for p in "${paths[@]}"; do
p="${(P)p}/bin"
if [ -d "$p" ]; then
[[ "$PATH" =~ "$p" ]] || export PATH="$p:$PATH"
fi
done
unset paths