From 4aa9b5a9a8b26b25d489073e938e5c903c49ec42 Mon Sep 17 00:00:00 2001 From: Alessandro Molari Date: Mon, 15 Dec 2014 10:14:03 +0000 Subject: [PATCH] Added configuration variables for paths --- init.zsh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/init.zsh b/init.zsh index 0b5d7c14..7beaaa44 100644 --- a/init.zsh +++ b/init.zsh @@ -11,7 +11,12 @@ # Set PREZTO_DIR to the default value if not already set if [ -z "${PREZTO_DIR}" ]; then - PREZTO_DIR=${ZDOTDIR:-$HOME}/.zprezto + PREZTO_DIR="${ZDOTDIR:-$HOME}/.zprezto" +fi + +# Set PREZTORC to the default value if not already set +if [ -z "${PREZTORC}" ]; then + PREZTORC="${ZDOTDIR:-$HOME}/.zpreztorc" fi # @@ -58,19 +63,19 @@ function pmodload { for pmodule in "$pmodules[@]"; do if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then continue - elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then + elif [[ ! -d "${PREZTO_DIR}/modules/$pmodule" ]]; then print "$0: no such module: $pmodule" >&2 continue else - if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" + if [[ -s "${PREZTO_DIR}/modules/$pmodule/init.zsh" ]]; then + source "${PREZTO_DIR}/modules/$pmodule/init.zsh" fi if (( $? == 0 )); then zstyle ":prezto:module:$pmodule" loaded 'yes' else # Remove the $fpath entry. - fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=() + fpath[(r)${PREZTO_DIR}/modules/${pmodule}/functions]=() function { local pfunction @@ -80,7 +85,7 @@ function pmodload { setopt LOCAL_OPTIONS EXTENDED_GLOB # Unload Prezto functions. - for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do + for pfunction in ${PREZTO_DIR}/modules/$pmodule/functions/$~pfunction_glob; do unfunction "$pfunction" done } @@ -96,8 +101,8 @@ function pmodload { # # Source the Prezto configuration file. -if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then - source "${ZDOTDIR:-$HOME}/.zpreztorc" +if [[ -s "${PREZTORC}" ]]; then + source ${PREZTORC} fi # Disable color and theme in dumb terminals.