Fix computing the list of unused modules by using the full `_zdirs`
instead of just the `_zmodules` names. The fixed code was even simpler
and cleaner, which makes it even more satisfying. :- )
Show "not found" instead of "not installed" error when an external
module dir does not exist, since we don't install external modules.
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Not installed. Run %Bzimfw install%b to install.%f"
if [[ ! -e ${zdir} ]]; then
if [[ -z ${zurl} ]]; then
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}: ${zdir}%b not found%f"
else
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Not installed. Run %Bzimfw install%b to install.%f"
fi
_zfailed=1
return 1
fi
local -ra prezto_fpaths=(${zdir}/functions(NF)) prezto_scripts=(${zdir}/init.zsh(N))
if (( ! ${#zfpaths} && ! ${#zcmds} && ${#prezto_fpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zfpaths=(${prezto_fpaths})
zcmds=("source ${^prezto_scripts[@]:A}")
else
if (( ! ${#zfpaths} )) zfpaths=(${prezto_fpaths})
if (( ! ${#zcmds} )); then
if (( ! ${#zfpaths} && ! ${#zcmds} )); then
zfpaths=(${zdir}/functions(NF))
local -ra prezto_scripts=(${zdir}/init.zsh(N))
if (( ${#zfpaths} && ${#prezto_scripts} )); then
# this follows the prezto module format, no need to check for other scripts
zcmds=("source ${^prezto_scripts[@]:A}")
else
# get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first)
local -ra zscripts=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
zcmds=("source ${^zscripts[@]:A}")
@ -170,7 +173,6 @@ Initialization options:
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then
_zimfw_print -u2 -PR "%F{yellow}<%= warn %>${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f"$'\n\n'${zusage}
fi
_zmodules+=(${zmodule})
_zdirs+=(${zdir})
# Prefix is added to all _zfpaths, _zfunctions and _zcmds to distinguish the originating modules
_zimfw_print -u2 -PR "%F{yellow}! ${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f"$'\n\n'${zusage}
fi
_zmodules+=(${zmodule})
_zdirs+=(${zdir})
# Prefix is added to all _zfpaths, _zfunctions and _zcmds to distinguish the originating modules
local -r zpre=${zmodule}$'\0'
@ -306,22 +308,21 @@ _zimfw_source_zimrc() {
_zimfw_list_unuseds(){
local -i i=1
local -a zinstalled=(${ZIM_HOME}/modules/*(N/:t)) subdirs