From 6c0f899c16211153a5945cdd3edd50d306c93af3 Mon Sep 17 00:00:00 2001 From: AtomicCoding Date: Wed, 4 Apr 2018 21:40:32 -0700 Subject: [PATCH] Updated Plugin Loading --- init.zsh | 18 +++++++++++++----- login_init.zsh | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/init.zsh b/init.zsh index 0ee95ed..d96fad7 100755 --- a/init.zsh +++ b/init.zsh @@ -30,12 +30,20 @@ fi # Initialize modules () { local zmodule - 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 + local 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 } @@ -78,4 +86,4 @@ Actions: *) print ${usage}; return 1 ;; esac -} +} \ No newline at end of file diff --git a/login_init.zsh b/login_init.zsh index 5735026..e60ae16 100755 --- a/login_init.zsh +++ b/login_init.zsh @@ -24,10 +24,21 @@ done # zcompile enabled module init scripts - for file in ${ZIM_HOME}/modules/${^zmodules}/init.zsh(-.N); do - zrecompile -pq ${file} + local zmodule + for zmodule (${zmodules}); do + local zmodule_dir=${ZIM_HOME}/modules/${zmodule} + if [[ -d ${zmodule_dir} ]]; then + 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 + zrecompile -pq ${zmodule_file} + break + fi + done + fi done - # zcompile all prompt setup scripts for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do zrecompile -pq ${file} @@ -42,4 +53,4 @@ # zsh-histery-substring-search zrecompile -pq ${ZIM_HOME}/modules/history-substring-search/external/zsh-history-substring-search.zsh -) &! +) &! \ No newline at end of file