2019-12-02 17:16:05 +00:00
|
|
|
#!/bin/zsh
|
2022-02-06 07:15:14 +00:00
|
|
|
source "$HOME/.config/wryn/env.zsh"
|
2022-08-23 23:44:56 +00:00
|
|
|
#####################################################################
|
2021-09-16 21:33:35 +00:00
|
|
|
INTERNAL_PLUGINS=(
|
|
|
|
"$DOTWRYN/zsh/config" # must load first
|
2022-08-23 23:44:56 +00:00
|
|
|
$(find "$DOTWRYN/zsh" -mindepth 1 -maxdepth 1 -type f \
|
|
|
|
| grep -v '/rc$' \
|
|
|
|
| grep -v '/config$' \
|
|
|
|
| grep -v '/\.[^/]\+$' \
|
|
|
|
)
|
2021-09-16 21:33:35 +00:00
|
|
|
)
|
2019-12-02 17:16:05 +00:00
|
|
|
|
2020-11-04 21:13:41 +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
|
2020-11-04 21:13:41 +00:00
|
|
|
|
2021-09-16 21:33:35 +00:00
|
|
|
local AVAILABLE_EDITOR=$EDITOR
|
2020-11-04 21:13:41 +00:00
|
|
|
|
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
|
|
|
|
2022-08-23 23:44:56 +00:00
|
|
|
export EDITOR="$AVAILABLE_EDITOR"
|
|
|
|
export VISUAL="$AVAILABLE_EDITOR"
|
2020-11-04 19:57:36 +00:00
|
|
|
}
|
2023-11-11 23:16:34 +00:00
|
|
|
|
2022-08-23 23:44:56 +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
|
2020-11-04 21:13:41 +00:00
|
|
|
SET_PREFERRED_EDITOR
|
2021-09-16 21:33:35 +00:00
|
|
|
WELCOME
|
2023-11-11 23:16:34 +00:00
|
|
|
|
|
|
|
echo $PATH | grep -q "^\\(.*:\\|\\)$HOME/.local/bin\\(:.*\\|\\)$" \
|
|
|
|
|| export PATH="$HOME/.local/bin:$PATH"
|
2022-08-23 23:44:56 +00:00
|
|
|
#####################################################################
|
2023-11-15 05:36:14 +00:00
|
|
|
|
|
|
|
[[ $TERM =~ alacritty ]] \
|
2024-04-13 22:59:36 +00:00
|
|
|
&& [[ $(tmux -L omni.socket list-clients | wc -l) -eq 0 ]] \
|
2023-11-15 05:36:14 +00:00
|
|
|
&& scwrypts tmux omni
|
|
|
|
|
2022-04-20 18:59:45 +00:00
|
|
|
true
|