mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 10:28:00 +00:00
Allow setting ZPREZTODIR to make prezto easier to integrate with
This commit is contained in:
parent
4f19700919
commit
7346efd206
17
init.zsh
17
init.zsh
@ -31,7 +31,7 @@ function pmodload {
|
||||
pmodules=("$argv[@]")
|
||||
|
||||
# Add functions to $fpath.
|
||||
fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
|
||||
fpath=(${pmodules:+$ZPREZTODIR/modules/${^pmodules}/functions(/FN)} $fpath)
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
@ -40,7 +40,7 @@ function pmodload {
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
|
||||
# Load Prezto functions.
|
||||
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
|
||||
for pfunction in $ZPREZTODIR/modules/${^pmodules}/functions/$~pfunction_glob; do
|
||||
autoload -Uz "$pfunction"
|
||||
done
|
||||
}
|
||||
@ -49,19 +49,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 "$ZPREZTODIR/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 "$ZPREZTODIR/modules/$pmodule/init.zsh" ]]; then
|
||||
source "$ZPREZTODIR/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)${ZPREZTODIR}/modules/${pmodule}/functions]=()
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
@ -71,7 +71,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 $ZPREZTODIR/modules/$pmodule/functions/$~pfunction_glob; do
|
||||
unfunction "$pfunction"
|
||||
done
|
||||
}
|
||||
@ -86,6 +86,9 @@ function pmodload {
|
||||
# Prezto Initialization
|
||||
#
|
||||
|
||||
# Find the dir Prezto is installed to
|
||||
ZPREZTODIR=${ZPREZTODIR:-${ZDOTDIR:-$HOME}/.zprezto}
|
||||
|
||||
# Source the Prezto configuration file.
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zpreztorc"
|
||||
|
Loading…
Reference in New Issue
Block a user