1
0
Fork 0
mirror of synced 2024-11-29 18:55:34 -05:00

Generic approach for zrecompiling scripts

* create digest of scripts in a `functions` directory that don't start
  with `_` (completion functions) and that don't have a `.` (function
  names cannot have that character)
* zrecompile any `.zsh` or `.zsh-theme` file that is not in a `*test*`
  directory (see 2a9a003), and that is a plain file with more than 1K of
  size.

instead of the fixed logic that was zrecompiling syntax-highlighting and
history-substring-search modules' scripts.

Closes #260
This commit is contained in:
Eric Nielsen 2018-04-09 18:09:07 -05:00
parent 468f99adfe
commit d74ceedef7

View file

@ -1,5 +1,3 @@
# #
# startup file read in interactive login shells # startup file read in interactive login shells
# #
@ -8,7 +6,7 @@
# #
( (
local dir file zmodule zmodule_dir local dir file
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
autoload -U zrecompile autoload -U zrecompile
@ -20,35 +18,16 @@
# zcompile enabled module autoloaded functions # zcompile enabled module autoloaded functions
for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do
zrecompile -pq ${dir}.zwc ${dir}/^([_.]*|prompt_*_setup|README*|*.zwc|*.zwc.old)(-.N) zrecompile -pq ${dir}.zwc ${dir}/^(_*|*.*)(-.N)
done done
# zcompile enabled module init scripts # zcompile enabled module scripts
for zmodule (${zmodules}); do for file (${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#*.zsh{,-theme}(.NLk+1)); do
zmodule_dir=${ZIM_HOME}/modules/${zmodule} zrecompile -pq ${file}
if [[ -d ${zmodule_dir} ]]; then
for file (${zmodule_dir}/init.zsh \
${zmodule_dir}/{,zsh-}${zmodule}.{zsh,plugin.zsh,zsh-theme,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
for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do
zrecompile -pq ${file} zrecompile -pq ${file}
done done
# syntax-highlighting
for file in ${ZIM_HOME}/modules/syntax-highlighting/external/highlighters/**^test-data/*.zsh; do
zrecompile -pq ${file}
done
zrecompile -pq ${ZIM_HOME}/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh
# zsh-histery-substring-search
zrecompile -pq ${ZIM_HOME}/modules/history-substring-search/external/zsh-history-substring-search.zsh
) &! ) &!