42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/bin/zsh
|
|
source "$HOME/.config/wryn/env/env.zsh"
|
|
# ---------------------------------------------------------------------
|
|
INTERNAL_PLUGINS=(
|
|
"$DOTWRYN/zsh/config" # must load first
|
|
$(find "$DOTWRYN/zsh" -maxdepth 1 -type f \
|
|
! -name 'rc' \
|
|
! -name 'config' \
|
|
)
|
|
)
|
|
|
|
SET_PREFERRED_EDITOR() {
|
|
# load preference from environment
|
|
[[ ${#PREFERRED_EDITOR[@]} -eq 0 ]] && {
|
|
echo 'unable to find $PREFERRED_EDITOR environment variable'
|
|
return 1
|
|
}
|
|
|
|
[[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] \
|
|
&& [[ $VISUAL == "${PREFERENCE[-1]}" ]] \
|
|
&& return 0
|
|
|
|
local AVAILABLE_EDITOR=$EDITOR
|
|
|
|
for program in $PREFERRED_EDITOR
|
|
do
|
|
which $program >/dev/null 2>&1 \
|
|
&& AVAILABLE_EDITOR="$program" \
|
|
&& break
|
|
done
|
|
|
|
export EDITOR="$AVAILABLE_EDITOR";
|
|
export VISUAL="$AVAILABLE_EDITOR";
|
|
}
|
|
# ---------------------------------------------------------------------
|
|
for p in $INTERNAL_PLUGINS; do source $p; done
|
|
for p in $EXTERNAL_PLUGINS; do [ -f $p ] && source $p; done
|
|
SET_PREFERRED_EDITOR
|
|
WELCOME
|
|
# ---------------------------------------------------------------------
|
|
return 0
|