[zsh] Fix up path

- Write prepend-to-path, to add a path component
- Add path to go binaries on OS X
This commit is contained in:
Eryn Wells 2015-01-03 18:36:35 -08:00
parent 73a201ed50
commit 7ad97f48ea
2 changed files with 23 additions and 23 deletions

41
env
View file

@ -1,7 +1,7 @@
# .env # .env
# vim: ft=zsh # vim: ft=zsh:
# #
# Environment settings for bash and derivatives. The env scripts are sources by # Environment settings for bash and derivatives. The env scripts are sourced by
# Zsh for every shell, even the non-interactive ones, so this needs to be small # Zsh for every shell, even the non-interactive ones, so this needs to be small
# and quick. Any configuration that will only be used for interactive sessions # and quick. Any configuration that will only be used for interactive sessions
# should be in the rc scripts. # should be in the rc scripts.
@ -16,27 +16,27 @@ export NOISY=0
print_heading -l 1 'Initializing environment' print_heading -l 1 'Initializing environment'
PAGER="less" export PAGER="less"
MANPAGER=$PAGER export MANPAGER=$PAGER
EDITOR="vim" export EDITOR="vim"
VISUAL=$EDITOR export VISUAL=$EDITOR
LESSHISTFILE="-" export LESSHISTFILE="-"
GREP_OPTIONS="--color=auto" export GREP_OPTIONS="--color=auto"
GREP_COLOR="1;32" export GREP_COLOR="1;32"
export PAGER MANPAGER \ function prepend-to-path
EDITOR VISUAL \ {
LESSHISTFILE \ if [[ -d "$1" ]]; then
GREP_OPTIONS GREP_COLOR path=("$1" $path)
export path
fi
}
path=("/usr/local/bin" "/usr/bin" "/bin" "/usr/local/sbin" "/usr/sbin" "/sbin") path=("/usr/local/bin" "/usr/bin" "/bin" "/usr/local/sbin" "/usr/sbin" "/sbin")
# NOTE: These prepended to $PATH in reverse order, so $HOME/bin will end up prepend-to-path "/usr/X11/bin"
# being the first path component. prepend-to-path "/opt/local/bin"
[[ -d "/usr/X11/bin" ]] && path+=("/usr/X11/bin") prepend-to-path "$HOME/.local/bin"
[[ -d "/opt/local/bin" ]] && path=("/opt/local/bin" $path) prepend-to-path "$HOME/bin"
[[ -d "$HOME/.local/bin" ]] && path=("$HOME/.local/bin" $path)
[[ -d "$HOME/bin" ]] && path=("$HOME/bin" $path)
export path export path
if which virtualenvwrapper.sh 1>/dev/null 2>&1; then if which virtualenvwrapper.sh 1>/dev/null 2>&1; then
@ -44,6 +44,7 @@ if which virtualenvwrapper.sh 1>/dev/null 2>&1; then
source `which virtualenvwrapper.sh` source `which virtualenvwrapper.sh`
fi fi
# Make sure gpg2 knows what to do with the curses-based smartcard PIN prompt.
export GPG_TTY=`tty` export GPG_TTY=`tty`
# System-specific settings # System-specific settings

View file

@ -1,9 +1,8 @@
# vim: set ft=zsh: # vim: set ft=zsh:
# Eryn Wells <eryn@erynwells.me> # Eryn Wells <eryn@erynwells.me>
[[ -d "$HOME/Library/Python/2.7/bin" ]] && path=("$HOME/Library/Python/2.7/bin" $path) prepend-to-path "$HOME/Library/Python/2.7/bin"
export PATH prepend-to-path "/usr/local/go/bin"
py27local="$HOME/Library/Python/2.7/lib/python/site-packages" py27local="$HOME/Library/Python/2.7/lib/python/site-packages"
if [[ -d "$py27local" ]]; then if [[ -d "$py27local" ]]; then