Refactor shell env initialization

This commit is contained in:
Henrik Lissner 2017-03-27 22:24:20 -04:00
parent c30d4eac93
commit d7b5ab30d2
3 changed files with 9 additions and 27 deletions

View file

@ -8,19 +8,12 @@ fi
## Bash rcfiles ########################### ## Bash rcfiles ###########################
source $HOME/.dotfiles/.common.sh source $HOME/.dotfiles/common.sh
declare -a paths=( PATH="$DOTFILES/bin:/usr/local/{bin,sbin}:$PATH"
"$DOTFILES/{bin,scripts}" for bin in "$ENABLED_DIR"/*/bin; do
"$HOME/.{rb,py}env/{shims,bin}" [[ -e "$bin" ]] && PATH="$bin:$PATH"
"/usr/local/{bin,sbin}"
)
[[ "$OSTYPE" == "darwin"* ]] && paths+="$(brew --prefix coreutils)/libexec/gnubin"
for index in ${!paths[*]}; do
[ -d ${paths[$index]} ] && PATH="${paths[$index]}:$PATH"
done done
unset paths
export PATH export PATH

View file

@ -1,15 +1,8 @@
# Loaded at the end of the initialization process # Loaded at the end of the initialization process
#
export EDITOR=$(is-callable nvim && echo 'nvim' || echo 'vim') export EDITOR=$(is-callable nvim && echo 'nvim' || echo 'vim')
export VISUAL=$EDITOR export VISUAL=$EDITOR
#
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
PATH="$DOTFILES/bin:$PATH" [[ $LANG ]] || export LANG='en_US.UTF-8'
bins=( "$ENABLED_DIR"/*/bin ) export TERMINFO="$HOME/.terminfo"
for bin in "${bins[@]}"; do
[[ -e "$bin" ]] && PATH="$bin:$PATH"
done
export PATH

View file

@ -1,9 +1,9 @@
## Paths ## Paths
source "$HOME/.dotfiles/shell/common.sh"
# Ensure path arrays do not contain duplicates. # Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path typeset -gU cdpath fpath mailpath path
path=( /usr/local/{,s}bin $path ) path=( $DOTFILES/bin "$ENABLED_DIR"/*/bin /usr/local/{,s}bin $path )
source "$HOME/.dotfiles/shell/common.sh"
load shell/zsh/config.zsh load shell/zsh/config.zsh
loadall env.zsh loadall env.zsh
@ -17,7 +17,3 @@ export LESS='-g -i -M -R -S -w -z-4'
if is-callable lesspipe; then if is-callable lesspipe; then
export LESSOPEN='| /usr/bin/env lesspipe %s 2>&-' export LESSOPEN='| /usr/bin/env lesspipe %s 2>&-'
fi fi
[[ $LANG ]] || export LANG='en_US.UTF-8'
export TERMINFO="$HOME/.terminfo"