1
0
Fork 0
mirror of synced 2024-11-03 00:18:57 -04:00

Give credit to zrecompile doc in zshcontrib(1)

and make code closer to the one in the manual pages (unless for our code
style). Why reinvent the wheel?

This last change makes the arguments to zrecompile shorter (passing
relative paths instead of full paths to each function file).
The number of arguments can be huge. There are 1143 of them currently
for /usr/local/Cellar/zsh/5.7.1/share/zsh/functions!
This commit is contained in:
Eric Nielsen 2019-12-10 19:28:00 -05:00
parent e2e2cfc22c
commit eaebf1731c
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
2 changed files with 7 additions and 5 deletions

View file

@ -12,12 +12,13 @@ _zimfw_compile() {
# Compile .zshrc # Compile .zshrc
zrecompile -p ${1} <%= home %>/.zshrc || return 1 zrecompile -p ${1} <%= home %>/.zshrc || return 1
# Compile autoloaded functions # Compile autoloaded functions, taken from zrecompile doc in zshcontrib(1)
for zdir in ${fpath}; do for zdir in ${fpath}; do
[[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue [[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue
zfile=(${zdir}/^(*.*)(N-.)) zfile=(${zdir}/^(*.*)(N-.))
if [[ -w ${zdir:h} && -n ${zfile} ]]; then if [[ -w ${zdir:h} && -n ${zfile} ]]; then
zrecompile -p ${1} ${zdir}.zwc ${zfile} || return 1 zfile=(${${(M)zfile%/*/*}#/})
(cd ${zdir:h} && zrecompile -p ${1} ${zdir:t}.zwc ${zfile}) || return 1
fi fi
done done

View file

@ -46,12 +46,13 @@ _zimfw_compile() {
# Compile .zshrc # Compile .zshrc
zrecompile -p ${1} ${ZDOTDIR:-${HOME}}/.zshrc || return 1 zrecompile -p ${1} ${ZDOTDIR:-${HOME}}/.zshrc || return 1
# Compile autoloaded functions # Compile autoloaded functions, taken from zrecompile doc in zshcontrib(1)
for zdir in ${fpath}; do for zdir in ${fpath}; do
[[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue [[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue
zfile=(${zdir}/^(*.*)(N-.)) zfile=(${zdir}/^(*.*)(N-.))
if [[ -w ${zdir:h} && -n ${zfile} ]]; then if [[ -w ${zdir:h} && -n ${zfile} ]]; then
zrecompile -p ${1} ${zdir}.zwc ${zfile} || return 1 zfile=(${${(M)zfile%/*/*}#/})
(cd ${zdir:h} && zrecompile -p ${1} ${zdir:t}.zwc ${zfile}) || return 1
fi fi
done done
@ -264,7 +265,7 @@ _zimfw_clean_dumpfile() {
} }
_zimfw_info() { _zimfw_info() {
print 'Zim version: 1.0.0-SNAPSHOT (previous commit is 69d609d)' print 'Zim version: 1.0.0-SNAPSHOT (previous commit is 660b8cd)'
print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a) print -R 'System info: '$(command uname -a)