mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-11-17 20:31:12 +00:00
Compile files into a pre-parsed form for faster sourcing.
This commit is contained in:
parent
e2eeef5f86
commit
9f4b8793e7
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,4 +1,2 @@
|
|||||||
locals.zsh
|
*.zwc
|
||||||
log/.zsh_history
|
*.zwc.old
|
||||||
projects.zsh
|
|
||||||
cache
|
|
||||||
|
@ -26,8 +26,26 @@ done
|
|||||||
# Load and run the prompt theming system.
|
# Load and run the prompt theming system.
|
||||||
autoload -Uz promptinit && promptinit -i
|
autoload -Uz promptinit && promptinit -i
|
||||||
|
|
||||||
# Compile zcompdump, if modified, to increase startup speed.
|
# Load the automatic recompiler.
|
||||||
if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -e "$HOME/.zcompdump.zwc" ]]; then
|
autoload -Uz zrecompile
|
||||||
zcompile "$HOME/.zcompdump"
|
|
||||||
fi
|
# Compile files.
|
||||||
|
for zsh_file in $HOME/.z{login,logout,profile,shenv,shrc,compdump}(N) $OMZ/*.zsh(N); do
|
||||||
|
zrecompile -q -p -U -z "$zsh_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Compile function directories.
|
||||||
|
for (( i=1; i <= $#fpath; i++ )); do
|
||||||
|
function_dir="$fpath[i]"
|
||||||
|
[[ "$function_dir" == (.|..) ]] \
|
||||||
|
|| [[ "$function_dir" == (.|..)/* ]] \
|
||||||
|
|| [[ ! -w "$function_dir:h" ]] && continue
|
||||||
|
function_files=($function_dir/^*(\.(rej|orig)|~|\#)(N-.))
|
||||||
|
[[ -n "$function_files" ]] \
|
||||||
|
&& function_files=(${${(M)function_files%/*/*}#/}) \
|
||||||
|
&& ( cd "$function_dir:h" && zrecompile -q -p -U -z "${function_dir:t}.zwc" "$function_files[@]" ) \
|
||||||
|
&& fpath[i]="$fpath[i].zwc"
|
||||||
|
done
|
||||||
|
unset function_dir
|
||||||
|
unset function_files
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user