dotwryn/zsh/rc

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-12-02 17:16:05 +00:00
#!/bin/zsh
2022-02-06 07:15:14 +00:00
source "$HOME/.config/wryn/env.zsh"
2021-09-16 21:33:35 +00:00
# ---------------------------------------------------------------------
INTERNAL_PLUGINS=(
"$DOTWRYN/zsh/config" # must load first
$(find "$DOTWRYN/zsh" -maxdepth 1 -type f \
! -name 'rc' \
! -name 'config' \
)
)
2019-12-02 17:16:05 +00:00
SET_PREFERRED_EDITOR() {
2021-09-16 21:33:35 +00:00
# load preference from environment
[[ ${#PREFERRED_EDITOR[@]} -eq 0 ]] && {
echo 'unable to find $PREFERRED_EDITOR environment variable'
return 1
}
2019-12-02 17:16:05 +00:00
2021-09-16 21:33:35 +00:00
[[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] \
&& [[ $VISUAL == "${PREFERENCE[-1]}" ]] \
&& return 0
2021-09-16 21:33:35 +00:00
local AVAILABLE_EDITOR=$EDITOR
2021-09-16 21:33:35 +00:00
for program in $PREFERRED_EDITOR
do
which $program >/dev/null 2>&1 \
&& AVAILABLE_EDITOR="$program" \
&& break
done
2019-12-02 17:16:05 +00:00
export EDITOR="$AVAILABLE_EDITOR";
export VISUAL="$AVAILABLE_EDITOR";
2020-11-04 19:57:36 +00:00
}
2021-09-16 21:33:35 +00:00
# ---------------------------------------------------------------------
for p in $INTERNAL_PLUGINS; do source $p; done
2021-09-17 02:21:19 +00:00
for p in $EXTERNAL_PLUGINS; do [ -f $p ] && source $p; done
SET_PREFERRED_EDITOR
2021-09-16 21:33:35 +00:00
WELCOME
# ---------------------------------------------------------------------
return 0