[zsh] Fix path setup

- Add setup-path function that allows resetting the path at any time.
- macOS does a dumb thing where it resets your path with some helper binary in
  /etc/zprofile. Disable GLOBAL_RCS in .zshenv so it doesn't read system init
  files.
This commit is contained in:
Eryn Wells 2018-04-14 09:41:42 -07:00
parent 7a69b98387
commit 75760856af
2 changed files with 21 additions and 8 deletions

26
env
View file

@ -40,14 +40,24 @@ function append-to-path
fi
}
path=("/usr/local/bin" "/usr/bin" "/bin" "/usr/local/sbin" "/usr/sbin" "/sbin")
prepend-to-path "/usr/X11/bin"
prepend-to-path "/opt/local/bin"
prepend-to-path "$HOME/.local/bin"
prepend-to-path "$HOME/.gem/ruby/2.2.0/bin"
prepend-to-path "$HOME/.cargo/bin"
prepend-to-path "$HOME/bin"
export path
function setup-path
{
export path=()
append-to-path "/usr/local/bin"
append-to-path "/usr/bin"
append-to-path "/bin"
append-to-path "/usr/local/sbin"
append-to-path "/usr/sbin"
append-to-path "/sbin"
prepend-to-path "/usr/X11/bin"
prepend-to-path "/opt/local/bin"
prepend-to-path "$HOME/.local/bin"
prepend-to-path "$HOME/.gem/ruby/2.2.0/bin"
prepend-to-path "$HOME/.cargo/bin"
prepend-to-path "$HOME/bin"
}
setup-path
if which virtualenvwrapper.sh 1>/dev/null 2>&1; then
export WORKON_HOME="$HOME/src/py/.envs"

3
zshenv
View file

@ -5,6 +5,9 @@
#
# Eryn Wells <eryn@erynwells.me>
# Don't read global startup. It messes things up...
unsetopt GLOBAL_RCS
[ -e $HOME/.env ] && source $HOME/.env
# System specific environment settings