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
|
||||
() {
|
||||
local zmodule
|
||||
local zmodule zmodule_dir zmodule_file
|
||||
|
||||
for zmodule (${zmodules}); do
|
||||
if [[ -s ${ZIM_HOME}/modules/${zmodule}/init.zsh ]]; then
|
||||
source ${ZIM_HOME}/modules/${zmodule}/init.zsh
|
||||
elif [[ ! -d ${ZIM_HOME}/modules/${zmodule} ]]; then
|
||||
zmodule_dir=${ZIM_HOME}/modules/${zmodule}
|
||||
if [[ ! -d ${zmodule_dir} ]]; then
|
||||
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
|
||||
done
|
||||
}
|
||||
|
|
|
@ -24,8 +24,20 @@
|
|||
done
|
||||
|
||||
# zcompile enabled module init scripts
|
||||
for file in ${ZIM_HOME}/modules/${^zmodules}/init.zsh(-.N); do
|
||||
zrecompile -pq ${file}
|
||||
local zmodule zmodule_dir
|
||||
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
|
||||
|
||||
# zcompile all prompt setup scripts
|
||||
|
|
Loading…
Reference in a new issue