-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zprofile
37 lines (36 loc) · 893 Bytes
/
.zprofile
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
pathmunge() {
local path_array before
# The default is to prepend the argument to PATH
before=1
case $1 in
after)
before=
;&
before)
shift
;;
esac
# Split PATH on : into an array
path_array=(${(As.:.)PATH})
# Then remove the arguments from it, since they are to be added in the
# order specified
path_array=(${path_array:|argv})
if [[ -n $before ]]
then
# Reverse the order of the arguments, so that:
# for f in ...; pathmunge f
# and
# pathmunge ...
# have the same effect.
path_array=(${(Oa)argv} $path_array)
else
path_array=($path_array $argv)
fi
# Concatenate the array back to PATH
export PATH="${(j.:.)path_array}"
}
[[ -n $GOPATH ]] && pathmunge "$GOPATH/bin"
[[ -d $HOME/bin ]] && pathmunge $HOME/bin
[[ -d $HOME/.local/bin ]] && pathmunge $HOME/.local/bin
[[ -d $HOME/.cargo/bin ]] && pathmunge $HOME/.cargo/bin
export EDITOR=vim