From 75760856af176cda1f5a00655619209255b16b81 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 14 Apr 2018 09:41:42 -0700 Subject: [PATCH] [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. --- env | 26 ++++++++++++++++++-------- zshenv | 3 +++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/env b/env index e1cadb8..3e27e51 100644 --- a/env +++ b/env @@ -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" diff --git a/zshenv b/zshenv index c26dd05..9ce7aa4 100644 --- a/zshenv +++ b/zshenv @@ -5,6 +5,9 @@ # # Eryn Wells +# Don't read global startup. It messes things up... +unsetopt GLOBAL_RCS + [ -e $HOME/.env ] && source $HOME/.env # System specific environment settings