1
0
Fork 0
mirror of synced 2024-06-20 23:51:09 -04:00
zimfw/login_init.zsh
Eric Nielsen d74ceedef7 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
2018-04-09 18:09:07 -05:00

34 lines
912 B
Bash
Executable file

#
# startup file read in interactive login shells
#
# The following code helps us by optimizing the existing framework.
# This includes zcompile, zcompdump, etc.
#
(
local dir file
setopt LOCAL_OPTIONS EXTENDED_GLOB
autoload -U zrecompile
# zcompile the completion cache; siginificant speedup
zrecompile -pq ${ZDOTDIR:-${HOME}}/${zcompdump_file:-.zcompdump}
# zcompile .zshrc
zrecompile -pq ${ZDOTDIR:-${HOME}}/.zshrc
# zcompile enabled module autoloaded functions
for dir in ${ZIM_HOME}/modules/${^zmodules}/functions(/FN); do
zrecompile -pq ${dir}.zwc ${dir}/^(_*|*.*)(-.N)
done
# zcompile enabled module scripts
for file (${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#*.zsh{,-theme}(.NLk+1)); do
zrecompile -pq ${file}
done
# zcompile all prompt setup scripts
for file in ${ZIM_HOME}/modules/prompt/functions/prompt_*_setup; do
zrecompile -pq ${file}
done
) &!