2018-06-15 13:43:04 +00:00
|
|
|
#!/usr/bin/env zsh
|
2018-02-23 09:38:24 +00:00
|
|
|
|
2019-05-11 11:54:20 +00:00
|
|
|
# tie these env variables to zsh arrays
|
|
|
|
typeset -T PKG_CONFIG_PATH pkg_config_path ':'
|
2020-04-18 11:53:08 +00:00
|
|
|
|
|
|
|
export PKG_CONFIG_PATH PATH MANPATH
|
2019-10-06 10:24:46 +00:00
|
|
|
|
|
|
|
path_prepend() {
|
2020-01-05 11:43:46 +00:00
|
|
|
if (( $# < 2 )); then
|
|
|
|
print >&2 "usage: $0 <var_name> <value...>"
|
|
|
|
return 1
|
2019-10-06 10:24:46 +00:00
|
|
|
fi
|
2020-01-05 11:43:46 +00:00
|
|
|
local var_name="$1"; shift
|
|
|
|
local value; for value in "$@"; do
|
|
|
|
if eval "(( \${${var_name}[(ie)\$value]} > \${#${var_name}} ))"; then
|
|
|
|
eval "${var_name}=(\"\$value\" \"\${${var_name}[@]}\")"
|
|
|
|
fi
|
|
|
|
done
|
2019-10-06 10:24:46 +00:00
|
|
|
}
|
|
|
|
|
2020-01-05 11:58:58 +00:00
|
|
|
if (( _is_macos )); then
|
2020-01-05 11:43:46 +00:00
|
|
|
# local Python binaries (for some reason they don't go into ~/.local/bin, but
|
|
|
|
# instead into the garbage ~/Library directory)
|
|
|
|
path_prepend path ~/Library/Python/*/bin(OnN)
|
2018-11-13 06:05:03 +00:00
|
|
|
|
2020-01-05 11:43:46 +00:00
|
|
|
# GNU counterparts of command line utilities
|
|
|
|
path_prepend path /usr/local/opt/*/libexec/gnubin(N)
|
|
|
|
path_prepend manpath /usr/local/opt/*/libexec/gnuman(N)
|
2019-05-01 14:40:25 +00:00
|
|
|
|
2020-01-05 11:43:46 +00:00
|
|
|
# add some keg-only Homebrew formulas
|
|
|
|
for formula in curl file-formula openssl ruby; do
|
2019-05-11 11:54:20 +00:00
|
|
|
formula_path="/usr/local/opt/$formula"
|
2020-01-05 11:43:46 +00:00
|
|
|
if [[ ! -d "$formula_path" ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -d "$formula_path/bin" ]]; then
|
|
|
|
path_prepend path "$formula_path/bin"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -d "$formula_path/lib/pkgconfig" ]]; then
|
|
|
|
path_prepend pkg_config_path "$formula_path/lib/pkgconfig"
|
2019-05-11 11:54:20 +00:00
|
|
|
fi
|
|
|
|
done
|
2020-01-05 11:43:46 +00:00
|
|
|
|
|
|
|
unset formula
|
2018-02-23 09:38:24 +00:00
|
|
|
fi
|
|
|
|
|
2019-10-06 10:24:46 +00:00
|
|
|
# Yarn global packages
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend path ~/.yarn/bin
|
2019-10-06 10:24:46 +00:00
|
|
|
|
|
|
|
# Go
|
2019-09-24 19:34:15 +00:00
|
|
|
export GOPATH=~/.go
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend path "$GOPATH/bin"
|
2018-11-28 19:00:09 +00:00
|
|
|
|
2019-09-24 19:34:15 +00:00
|
|
|
# Rust
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend path ~/.cargo/bin
|
2019-09-24 19:34:15 +00:00
|
|
|
# check if the Rust toolchain was installed via rustup
|
|
|
|
if rustup_home="$(rustup show home 2> /dev/null)" &&
|
|
|
|
rust_sysroot="$(rustc --print sysroot 2> /dev/null)" &&
|
|
|
|
[[ -d "$rustup_home" && -d "$rust_sysroot" && "$rust_sysroot" == "$rustup_home"/* ]]
|
|
|
|
then
|
|
|
|
# add paths of the selected Rust toolchain
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend fpath "$rust_sysroot/share/zsh/site-functions"
|
|
|
|
path_prepend manpath "$rust_sysroot/share/man"
|
2019-09-24 19:34:15 +00:00
|
|
|
fi
|
|
|
|
unset rustup_home rust_sysroot
|
2018-10-11 20:38:05 +00:00
|
|
|
|
2019-05-11 11:54:20 +00:00
|
|
|
# add my binaries and completions
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend path "${ZSH_DOTFILES:h}/scripts"
|
|
|
|
path_prepend fpath "$ZSH_DOTFILES/completions"
|
2018-11-13 06:05:03 +00:00
|
|
|
|
2019-09-24 19:34:15 +00:00
|
|
|
# add user binaries
|
2020-01-05 11:43:46 +00:00
|
|
|
path_prepend path ~/.local/bin
|
|
|
|
|
|
|
|
unfunction path_prepend
|