dotwryn/zsh/rc
2021-02-24 17:38:02 -07:00

45 lines
1.4 KiB
Bash

#!/bin/zsh
source "$HOME/.config/wryn/env/env"
# --- 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
# --- welcome message ----------------------------------------------
CUSTOM_WELCOME="$HOME/.config/wryn/custom-welcome"
[ -f "$CUSTOM_WELCOME" ] \
&& { "$CUSTOM_WELCOME" } \
|| { exec figlet "Welcome, beautiful" | lolcat; echo; cowsay -p "damn u sexy" | lolcat; }