rc simplification
This commit is contained in:
parent
1d43858965
commit
2d3e13e5c2
7
env/env.zsh
vendored
7
env/env.zsh
vendored
@ -10,14 +10,12 @@ WALLPAPER_PATH="$HOME/Pictures/bg"
|
|||||||
### Application Settings ############################################
|
### Application Settings ############################################
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
# ordered from least-preferred to most-preferred
|
|
||||||
PREFERRED_EDITOR=(vi vim)
|
|
||||||
|
|
||||||
# should play an audio file argument
|
# should play an audio file argument
|
||||||
MEDIA_ENGINE='canberra-gtk-play -f'
|
MEDIA_ENGINE='canberra-gtk-play -f'
|
||||||
|
|
||||||
RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
|
RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
|
||||||
TMUX_DEFAULT_SESSION_NAME='wryn'
|
TMUX_DEFAULT_SESSION_NAME='wryn'
|
||||||
|
PREFERRED_EDITOR=(vim vi)
|
||||||
WEBBROWSER='google-chrome-stable'
|
WEBBROWSER='google-chrome-stable'
|
||||||
|
|
||||||
PS1_BRANCH_SYMBOL=''
|
PS1_BRANCH_SYMBOL=''
|
||||||
@ -25,12 +23,13 @@ PS1_INDICATOR_SYMBOL='☕'
|
|||||||
PS1_SEPARATOR='::'
|
PS1_SEPARATOR='::'
|
||||||
PS1_USER='%n'
|
PS1_USER='%n'
|
||||||
|
|
||||||
|
WELCOME () { { figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy' } | lolcat }
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
### External Plugins / Settings #####################################
|
### External Plugins / Settings #####################################
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
EXTERNAL_PLUGIN_LIST=(
|
EXTERNAL_PLUGINS=(
|
||||||
"$DOTWRYN/zsh/plugins/z/z.sh"
|
"$DOTWRYN/zsh/plugins/z/z.sh"
|
||||||
'/usr/share/fzf/key-bindings.zsh'
|
'/usr/share/fzf/key-bindings.zsh'
|
||||||
'/usr/share/fzf/completion.zsh'
|
'/usr/share/fzf/completion.zsh'
|
||||||
|
66
zsh/rc
66
zsh/rc
@ -1,49 +1,41 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
source "$HOME/.config/wryn/env/env.zsh"
|
source "$HOME/.config/wryn/env/env.zsh"
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
INTERNAL_PLUGINS=(
|
||||||
|
"$DOTWRYN/zsh/config" # must load first
|
||||||
|
$(find "$DOTWRYN/zsh" -maxdepth 1 -type f \
|
||||||
|
! -name 'rc' \
|
||||||
|
! -name 'config' \
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# --- 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() {
|
SET_PREFERRED_EDITOR() {
|
||||||
# load preference from environment (vi vim) by default
|
# load preference from environment
|
||||||
[[ -z $PREFERRED_EDITOR ]] && { echo 'unable to find $PREFERRED_EDITOR environment variable'; return 1; }
|
[[ ${#PREFERRED_EDITOR[@]} -eq 0 ]] && {
|
||||||
|
echo 'unable to find $PREFERRED_EDITOR environment variable'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
[[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] && [[ $VISUAL == "${PREFERENCE[-1]}" ]] && return 0;
|
[[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] \
|
||||||
|
&& [[ $VISUAL == "${PREFERENCE[-1]}" ]] \
|
||||||
|
&& return 0
|
||||||
|
|
||||||
local AVAILABLE_EDITOR="$EDITOR";
|
local AVAILABLE_EDITOR=$EDITOR
|
||||||
|
|
||||||
for program in $PREFERRED_EDITOR; do which $program >/dev/null 2>&1 && AVAILABLE_EDITOR="$program"; done
|
for program in $PREFERRED_EDITOR
|
||||||
|
do
|
||||||
|
which $program >/dev/null 2>&1 \
|
||||||
|
&& AVAILABLE_EDITOR="$program" \
|
||||||
|
&& break
|
||||||
|
done
|
||||||
|
|
||||||
export EDITOR="$AVAILABLE_EDITOR";
|
export EDITOR="$AVAILABLE_EDITOR";
|
||||||
export VISUAL="$AVAILABLE_EDITOR";
|
export VISUAL="$AVAILABLE_EDITOR";
|
||||||
}
|
}
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
for p in $INTERNAL_PLUGINS; do source $p; done
|
||||||
|
for p in $EXTERNAL_PLUGINS; do source $p; done
|
||||||
SET_PREFERRED_EDITOR
|
SET_PREFERRED_EDITOR
|
||||||
|
WELCOME
|
||||||
# --- load external plugins ----------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
|
return 0
|
||||||
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; }
|
|
||||||
|
Loading…
Reference in New Issue
Block a user