2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
# startup file read in interactive login shell
|
|
|
|
# not run again in subsuquent shells
|
|
|
|
#
|
|
|
|
# The following code helps us by optimizing the existing framework.
|
2015-12-28 02:09:44 -05:00
|
|
|
# This includes zcompile, zcompdump, etc.
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
(
|
|
|
|
# Function to determine the need of a zcompile. If the .zwc file
|
|
|
|
# does not exist, or the base file is newer, we need to compile.
|
|
|
|
# These jobs are asynchronous, and will not impact the interactive shell
|
|
|
|
zcompare() {
|
|
|
|
if [[ -s ${1} && ( ! -s ${1}.zwc || ${1} -nt ${1}.zwc) ]]; then
|
|
|
|
# needs zcomplie
|
|
|
|
zcompile ${1}
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
# no need to zcompile
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
2015-12-15 00:12:17 -05:00
|
|
|
|
|
|
|
# First, we will zcompile the completion cache, if it exists. Siginificant speedup.
|
2015-12-19 09:48:29 -05:00
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zcompdump
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-16 02:23:18 -05:00
|
|
|
# Next, zcompile .zshrc if needed
|
2015-12-19 09:48:29 -05:00
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zshrc
|
2015-12-16 02:23:18 -05:00
|
|
|
|
2015-12-27 04:14:35 -05:00
|
|
|
# Now, zcompile some light module init scripts
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/git/init.zsh
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/utility/init.zsh
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/pacman/init.zsh
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/spectrum/init.zsh
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/completion/init.zsh
|
|
|
|
zcompare ${ZDOTDIR:-${HOME}}/.zim/modules/custom/init.zsh
|
2015-12-20 20:41:54 -05:00
|
|
|
|
2015-12-27 04:14:35 -05:00
|
|
|
# Then, we should zcompile the 'heavy' modules where possible.
|
2015-12-15 00:12:17 -05:00
|
|
|
# This includes syntax-highlighting and completion.
|
|
|
|
# Other modules may be added to this list at a later date.
|
2015-12-28 02:09:44 -05:00
|
|
|
zim=${ZDOTDIR:-${HOME}}/.zim
|
|
|
|
setopt EXTENDED_GLOB
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
#
|
|
|
|
# syntax-highlighting zcompile
|
|
|
|
#
|
|
|
|
if [[ -d ${zim}/modules/syntax-highlighting/external/highlighters ]]; then
|
|
|
|
# compile the highlighters
|
|
|
|
for file in ${zim}/modules/syntax-highlighting/external/highlighters/**/*.zsh; do
|
|
|
|
zcompare ${file}
|
|
|
|
done
|
|
|
|
# compile the main file
|
|
|
|
zcompare ${zim}/modules/syntax-highlighting/external/zsh-syntax-highlighting.zsh
|
|
|
|
fi
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
#
|
|
|
|
# zsh-histery-substring-search zcompile
|
|
|
|
#
|
|
|
|
if [[ -s ${zim}/modules/history-substring-search/external/zsh-history-substring-search.zsh ]]; then
|
|
|
|
zcompare ${zim}/modules/history-substring-search/external/zsh-history-substring-search.zsh
|
|
|
|
fi
|
|
|
|
|
2015-12-15 00:12:17 -05:00
|
|
|
|
2015-12-28 02:09:44 -05:00
|
|
|
) &!
|