dotfiles/lib/path.zsh

55 lines
1.8 KiB
Bash
Raw Normal View History

2018-06-15 13:43:04 +00:00
#!/usr/bin/env zsh
2018-02-23 09:38:24 +00:00
2018-11-13 06:05:03 +00:00
# make these variables unique (-U) arrays (-a)
typeset -aU fpath manpath path
2018-02-23 09:38:24 +00:00
if is_macos; then
2018-11-13 06:05:03 +00:00
path=(
~/Library/Python/bin
~/Library/Haskell/bin
/usr/local/opt/file-formula/bin # file
/usr/local/opt/gnu-sed/libexec/gnubin # GNU sed
/usr/local/opt/gnu-tar/libexec/gnubin # GNU tar
/usr/local/opt/unzip/bin # GNU unzip
/usr/local/opt/openssl/bin # openssl
/usr/local/opt/gnu-getopt/bin # getopt
/usr/local/opt/findutils/libexec/gnubin # GNU findutils
/usr/local/opt/binutils/bin # GNU binutils
/usr/local/opt/coreutils/libexec/gnubin # GNU coreutils
"${path[@]}"
)
manpath=(
/usr/local/opt/file-formula/share/man # file
/usr/local/opt/gnu-sed/libexec/gnuman # GNU sed
/usr/local/opt/gnu-tar/libexec/gnuman # GNU tar
/usr/local/opt/unzip/share/man # GNU unzip
/usr/local/opt/openssl/share/man # openssl
/usr/local/opt/gnu-getopt/share/man # getopt
/usr/local/opt/findutils/libexec/gnuman # GNU findutils
/usr/local/opt/binutils/share/man # GNU binutils
/usr/local/opt/coreutils/libexec/gnuman # GNU coreutils
"${manpath[@]}"
)
2018-02-23 09:38:24 +00:00
fi
2018-11-13 06:05:03 +00:00
# add user binaries
path=(~/bin ~/.local/bin "${path[@]}")
2018-10-11 20:38:05 +00:00
2018-11-13 06:05:03 +00:00
# add my completions
fpath=("$DOTFILES_PATH/completions" "${fpath[@]}")
# check for Rust installed via rustup
2018-11-13 21:59:41 +00:00
if rust_sysroot="$(~/.cargo/bin/rustc --print sysroot)"; then
2018-11-13 06:05:03 +00:00
# add paths to the current Rust toolchain
path=(~/.cargo/bin "${path[@]}")
fpath=("$rust_sysroot/share/zsh/site-functions" "${fpath[@]}")
manpath=("$rust_sysroot/share/man" "${manpath[@]}")
2018-10-11 20:38:05 +00:00
fi
2018-11-13 06:05:03 +00:00
unset rust_sysroot
# add colon after MANPATH so that it doesn't overwrite system MANPATH
MANPATH="$MANPATH:"
2018-09-09 12:15:20 +00:00
2018-11-13 06:05:03 +00:00
export PATH MANPATH