1
0
Fork 0
mirror of synced 2024-05-28 04:51:11 -04:00
zimfw/src/templates/login_init.zsh.erb
Eric Nielsen 315cd48e73
Generate login_init.zsh file
So we can have the following code in the zlogin template:

    source ${ZIM_HOME}/login_init.zsh -q &!

instead of depending on the zimfw function there. This allows fixing the
issue were a non-interactive login shell currently yields:

    command not found: zimfw.

To fully fix the issue, we also need a new zshenv template containing:

    ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim

Templates will be updated in the install script.
2019-12-14 22:21:34 -05:00

34 lines
1,014 B
Plaintext

() {
setopt LOCAL_OPTIONS CASE_GLOB 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, taken from zrecompile doc in zshcontrib(1)
for zdir in ${fpath}; do
[[ ${zdir} == (.|..) || ${zdir} == (.|..)/* ]] && continue
zfile=(${zdir}/^(*.*)(N-.))
if [[ -w ${zdir:h} && -n ${zfile} ]]; then
zfile=(${${(M)zfile%/*/*}#/})
(builtin cd -q ${zdir:h} && zrecompile -p ${1} ${zdir:t}.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 '<%= done %>Done with compile.'
fi
} "${@}"