diff --git a/wish.sh b/wish.sh index d4cc42c..a139ea4 100644 --- a/wish.sh +++ b/wish.sh @@ -10,10 +10,26 @@ function wish_print_right_prompt() { } function wish_init() { + # Find default config file if WISH_CONFIG_FILE is unset + if [[ ! -v WISH_CONFIG_FILE ]]; then + for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + if [[ -f "$path/wish/config.gie" ]]; then + WISH_CONFIG_FILE="$path/wish/config.gie" + break + fi + done + fi + # Source config files + for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do + if [[ -f "$path/wish/wish.py" ]]; then + source <($path/wish/wish.py ${WISH_CONFIG_FILE[@]}) + break + fi + done # Source all plugins local plugin local path - for plugin in ${WISH_PLUGINS[@]} ${WISH_RIGHT_PLUGINS[@]}; do + for plugin in ${WISH_PLUGINS_SOURCE[@]}; do for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do source "$path/wish/plugins/$plugin.sh" &> /dev/null && break done