Update the module loading system
to load modules with `{module_name}.plugin.zsh` and `{module_name}.zsh` in order to improve compatibility. Closes ##257
This commit is contained in:
parent
56b61e211d
commit
2ea2ba2fc8
2 changed files with 27 additions and 6 deletions
17
init.zsh
17
init.zsh
|
@ -29,13 +29,22 @@ fi
|
||||||
|
|
||||||
# Initialize modules
|
# Initialize modules
|
||||||
() {
|
() {
|
||||||
local zmodule
|
local zmodule zmodule_dir zmodule_file
|
||||||
|
|
||||||
for zmodule (${zmodules}); do
|
for zmodule (${zmodules}); do
|
||||||
if [[ -s ${ZIM_HOME}/modules/${zmodule}/init.zsh ]]; then
|
zmodule_dir=${ZIM_HOME}/modules/${zmodule}
|
||||||
source ${ZIM_HOME}/modules/${zmodule}/init.zsh
|
if [[ ! -d ${zmodule_dir} ]]; then
|
||||||
elif [[ ! -d ${ZIM_HOME}/modules/${zmodule} ]]; then
|
|
||||||
print "No such module \"${zmodule}\"." >&2
|
print "No such module \"${zmodule}\"." >&2
|
||||||
|
else
|
||||||
|
for zmodule_file (${zmodule_dir}/{,zsh-}${zmodule}.zsh-theme \
|
||||||
|
${zmodule_dir}/init.zsh \
|
||||||
|
${zmodule_dir}/{,zsh-}${zmodule}.plugin.zsh \
|
||||||
|
${zmodule_dir}/{,zsh-}${zmodule}.{z,}sh); do
|
||||||
|
if [[ -f ${zmodule_file} ]]; then
|
||||||
|
source ${zmodule_file}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,20 @@
|
||||||
done
|
done
|
||||||
|
|
||||||
# zcompile enabled module init scripts
|
# zcompile enabled module init scripts
|
||||||
for file in ${ZIM_HOME}/modules/${^zmodules}/init.zsh(-.N); do
|
local zmodule zmodule_dir
|
||||||
zrecompile -pq ${file}
|
for zmodule (${zmodules}); do
|
||||||
|
zmodule_dir=${ZIM_HOME}/modules/${zmodule}
|
||||||
|
if [[ -d ${zmodule_dir} ]]; then
|
||||||
|
for file (${zmodule_dir}/{,zsh-}${zmodule}.zsh-theme \
|
||||||
|
${zmodule_dir}/init.zsh \
|
||||||
|
${zmodule_dir}/{,zsh-}${zmodule}.plugin.zsh \
|
||||||
|
${zmodule_dir}/{,zsh-}${zmodule}.{z,}sh); do
|
||||||
|
if [[ -f ${file} ]]; then
|
||||||
|
zrecompile -pq ${file}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# zcompile all prompt setup scripts
|
# zcompile all prompt setup scripts
|
||||||
|
|
Loading…
Reference in a new issue