1
0
Fork 0

remove the fpath entry if module fails to laod and only load functions if the module has loaded

This also fixes the fpath not being set on zsh 4.26 on el5 by removing it from the function()
pull/202/head
Ben O'Hara 13 years ago
parent dbf7b824f6
commit 302759f82c

@ -38,23 +38,6 @@ function omodload {
# $argv is overridden in the anonymous function.
omodules=("$argv[@]")
function {
local ofunction
# Extended globbing is needed for listing autoloadable function directories.
setopt LOCAL_OPTIONS EXTENDED_GLOB
# Add functions to fpath.
fpath=(${omodules:+${OMZ}/modules/${^omodules}/functions(/FN)} $fpath)
# Load Oh My Zsh functions.
for ofunction in \
$OMZ/modules/${^omodules}/functions/^([_.]*|prompt_*_setup|README*)(.N:t)
do
autoload -Uz "$ofunction"
done
}
for omodule in "$omodules[@]"; do
if zstyle -t ":omz:module:$omodule" loaded; then
continue
@ -63,13 +46,22 @@ function omodload {
continue
else
if [[ -s "$OMZ/modules/$omodule/init.zsh" ]]; then
# Add functions to fpath.
fpath=(${OMZ}/modules/${^omodule}/functions(/FN) $fpath)
source "$OMZ/modules/$omodule/init.zsh"
fi
if (( $? == 0 )); then
zstyle ":omz:module:$omodule" loaded 'yes'
# Load Oh My Zsh functions.
for ofunction in \
$OMZ/modules/${omodule}/functions/^([_.]*|prompt_*_setup|README*)(.N:t)
do
autoload -Uz "$ofunction"
done
else
zstyle ":omz:module:$omodule" loaded 'no'
# remove the fpath entry
fpath[(r)$OMZ/modules/${omodule}/functions]=()
fi
fi
done

Loading…
Cancel
Save