1
0
Fork 0
mirror of synced 2024-06-26 02:11:09 -04:00
zimfw/src/stage1/50_zimfw_compile.zsh.erb
Eric Nielsen 69d609dfb2
Don't fail zimfw compile on empty fpath dir
otherwise it would fail with, for example

    zrecompile:zcompile:133: can't open file /usr/local/share/zsh/site-functions
2019-12-09 21:34:12 -05:00

33 lines
906 B
Plaintext

_zimfw_compile() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
autoload -U zrecompile
local zdumpfile zdir zfile
# Compile the completion cache; significant speedup
zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile="<%= home %>/.zcompdump"
if [[ -f ${zdumpfile} ]]; then
zrecompile -p ${1} ${zdumpfile} || return 1
fi
# Compile .zshrc
zrecompile -p ${1} <%= home %>/.zshrc || return 1
# Compile autoloaded functions
for zdir in ${fpath}; do
[[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue
zfile=(${zdir}/^(*.*)(N-.))
if [[ -w ${zdir:h} && -n ${zfile} ]]; then
zrecompile -p ${1} ${zdir}.zwc ${zfile} || return 1
fi
done
# Compile scripts
for zfile in ${ZIM_HOME}/(^*test*/)#*.zsh{,-theme}(N-.); do
zrecompile -p ${1} ${zfile} || return 1
done
if [[ ${1} != -q ]]; then
print -P '%F{green}✓%f Done with compile.'
fi
}