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

View file

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

View file

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