1
0
Fork 0
mirror of synced 2024-09-19 03:52:54 -04:00
zimfw/templates/zlogin
Eric Nielsen 715f4a4e9c [template] Use zrecompile and create digest zwc file
for the autoloaded functions. According to the `zshbuiltins`
documentation:

    Files containing multiple compiled functions are called `digest'
    files,  and are intended to be used as elements of the FPATH/fpath
    special array.

Also compiling all module init files, instead of some selected ones.
This didn't impact performance much (time to run async block in zlogin
when from 0.22s to 0.25s on my machine).

Didn't manage to make adding the prompt `prompt_*_setup` functions to
the digest file work, so kept these separate.

Closes #86
2017-09-26 12:45:24 -05:00

45 lines
1.2 KiB
Bash

#
# startup file read in interactive login shells
#
# The following code helps us by optimizing the existing framework.
# This includes zcompile, zcompdump, etc.
#
(
local zim_mods=${ZIM_HOME}/modules
setopt EXTENDED_GLOB
autoload -U zrecompile
# zcompile the completion cache; siginificant speedup.
for file in ${ZDOTDIR:-${HOME}}/.zcomp^(*.zwc)(.); do
zrecompile -pq ${file}
done
# zcompile .zshrc
zrecompile -pq ${ZDOTDIR:-${HOME}}/.zshrc
# zcompile all module init scripts
for file in ${zim_mods}/*/init.zsh; do
zrecompile -pq ${file}
done
# zcompile all autoloaded functions
zrecompile -pq ${ZIM_HOME}/functions ${zim_mods}/*/functions/^([_.]*|prompt_*_setup|README*|*.zwc)(.)
# zcompile all prompt setup scripts
for file in ${zim_mods}/prompt/functions/prompt_*_setup; do
zrecompile -pq ${file}
done
# syntax-highlighting
for file in ${zim_mods}/syntax-highlighting/external/highlighters/**^test-data/*.zsh; do
zrecompile -pq ${file}
done
zrecompile -pq ${zim_mods}/syntax-highlighting/external/zsh-syntax-highlighting.zsh
# zsh-histery-substring-search
zrecompile -pq ${zim_mods}/history-substring-search/external/zsh-history-substring-search.zsh
) &!