1
0
Fork 0
mirror of synced 2024-12-22 22:18:57 -05:00

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:
Atomic Coding 2018-03-21 20:19:05 -07:00 committed by Eric Nielsen
parent 56b61e211d
commit 2ea2ba2fc8
2 changed files with 27 additions and 6 deletions

View file

@ -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
}

View file

@ -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