dotwryn/zsh/rc

52 lines
1.3 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" -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
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
}
2023-11-11 23:16:34 +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
2023-11-11 23:16:34 +00:00
echo $PATH | grep -q "^\\(.*:\\|\\)$HOME/.local/bin\\(:.*\\|\\)$" \
|| export PATH="$HOME/.local/bin:$PATH"
#####################################################################
[[ $TERM =~ alacritty ]] \
&& [[ $(tmux -L omni.socket list-clients | wc -l) -eq 0 ]] \
&& scwrypts tmux omni
2022-04-20 18:59:45 +00:00
true