|
|
@ -23,15 +23,22 @@ unset min_zsh_version
|
|
|
|
|
|
|
|
|
|
|
|
# Loads Prezto modules.
|
|
|
|
# Loads Prezto modules.
|
|
|
|
function pmodload {
|
|
|
|
function pmodload {
|
|
|
|
|
|
|
|
pmodload_path "${ZDOTDIR:-$HOME}/.zprezto/modules" "$argv[@]"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pmodload_path {
|
|
|
|
local -a pmodules
|
|
|
|
local -a pmodules
|
|
|
|
|
|
|
|
local modules_path
|
|
|
|
local pmodule
|
|
|
|
local pmodule
|
|
|
|
local pfunction_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)'
|
|
|
|
local pfunction_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules_path="${argv[1]}"
|
|
|
|
|
|
|
|
shift
|
|
|
|
# $argv is overridden in the anonymous function.
|
|
|
|
# $argv is overridden in the anonymous function.
|
|
|
|
pmodules=("$argv[@]")
|
|
|
|
pmodules=("$argv[@]")
|
|
|
|
|
|
|
|
|
|
|
|
# Add functions to $fpath.
|
|
|
|
# Add functions to $fpath.
|
|
|
|
fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
|
|
|
|
fpath=(${pmodules:+${modules_path}/${^pmodules}/functions(/FN)} $fpath)
|
|
|
|
|
|
|
|
|
|
|
|
function {
|
|
|
|
function {
|
|
|
|
local pfunction
|
|
|
|
local pfunction
|
|
|
@ -40,7 +47,7 @@ function pmodload {
|
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
|
|
|
|
|
|
|
|
# Load Prezto functions.
|
|
|
|
# Load Prezto functions.
|
|
|
|
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
|
|
|
|
for pfunction in ${modules_path}/${^pmodules}/functions/$~pfunction_glob; do
|
|
|
|
autoload -Uz "$pfunction"
|
|
|
|
autoload -Uz "$pfunction"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -49,19 +56,19 @@ function pmodload {
|
|
|
|
for pmodule in "$pmodules[@]"; do
|
|
|
|
for pmodule in "$pmodules[@]"; do
|
|
|
|
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
|
|
|
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then
|
|
|
|
elif [[ ! -d "${modules_path}/$pmodule" ]]; then
|
|
|
|
print "$0: no such module: $pmodule" >&2
|
|
|
|
print "$0: no such module: $pmodule" >&2
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then
|
|
|
|
if [[ -s "${modules_path}/$pmodule/init.zsh" ]]; then
|
|
|
|
source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh"
|
|
|
|
source "${modules_path}/$pmodule/init.zsh"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if (( $? == 0 )); then
|
|
|
|
if (( $? == 0 )); then
|
|
|
|
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
|
|
|
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# Remove the $fpath entry.
|
|
|
|
# Remove the $fpath entry.
|
|
|
|
fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=()
|
|
|
|
fpath[(r)${modules_path}/${pmodule}/functions]=()
|
|
|
|
|
|
|
|
|
|
|
|
function {
|
|
|
|
function {
|
|
|
|
local pfunction
|
|
|
|
local pfunction
|
|
|
@ -71,7 +78,7 @@ function pmodload {
|
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
|
|
|
|
|
|
|
|
# Unload Prezto functions.
|
|
|
|
# Unload Prezto functions.
|
|
|
|
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do
|
|
|
|
for pfunction in ${modules_path}/$pmodule/functions/$~pfunction_glob; do
|
|
|
|
unfunction "$pfunction"
|
|
|
|
unfunction "$pfunction"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|