dotwryn/zsh/rc
2021-09-15 01:48:37 -06:00

50 lines
1.5 KiB
Bash

#!/bin/zsh
source "$HOME/.config/wryn/env/env.zsh"
# --- load custom plugins ------------------------------------------
# zsh config : must load first for zsh-plugins to work
source "$DOTWRYN/zsh/config"
for file in $(find "$DOTWRYN/zsh" -maxdepth 1 -type f ! -name 'rc' ! -name 'config'); do source $file; done;
# operating system specific plugins
case "$OSTYPE" in
linux-gnu )
for file in $(find "$DOTWRYN/zsh/linux" -type f); do source $file; done;
;;
darwin* )
for file in $(find "$DOTWRYN/zsh/osx" -type f); do source $file; done;
;;
esac
# --- set default editor -------------------------------------------
SET_PREFERRED_EDITOR() {
# load preference from environment (vi vim) by default
[[ -z $PREFERRED_EDITOR ]] && { 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"; done
export EDITOR="$AVAILABLE_EDITOR";
export VISUAL="$AVAILABLE_EDITOR";
}
SET_PREFERRED_EDITOR
# --- load external plugins ----------------------------------------
for PLUGIN in $EXTERNAL_PLUGIN_LIST; do
[ -f "$PLUGIN" ] && source "$PLUGIN"
done
# --- welcome message ----------------------------------------------
CUSTOM_WELCOME="$HOME/.config/wryn/welcome"
[ -f "$CUSTOM_WELCOME" ] \
&& { source "$CUSTOM_WELCOME" } \
|| { { figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy' } | lolcat; }