summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonson Shao <holymonson@gmail.com>2022-09-08 01:03:45 +0800
committerGitHub <noreply@github.com>2022-09-07 19:03:45 +0200
commit875a4553204679cc1e3023a7d0e0bf2cf7d60800 (patch)
tree18d576601c0aa12699153c7a9a75c68b58deeddc
parent6d48309cd7da1b91038cf08be7865fb5bb9bc5ea (diff)
downloadzsh-875a4553204679cc1e3023a7d0e0bf2cf7d60800.tar.gz
zsh-875a4553204679cc1e3023a7d0e0bf2cf7d60800.tar.bz2
zsh-875a4553204679cc1e3023a7d0e0bf2cf7d60800.zip
perf: `zrecompile` the compdump file to speed up startup (#8802)
-rw-r--r--oh-my-zsh.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 925ee46aa..d6ef97a07 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -67,7 +67,7 @@ fi
fpath=("$ZSH/functions" "$ZSH/completions" $fpath)
# Load all stock functions (from $fpath files) called below.
-autoload -U compaudit compinit
+autoload -U compaudit compinit zrecompile
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
@@ -142,6 +142,9 @@ EOF
fi
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
+# zcompile the completion dump file if the .zwc is older or missing.
+zrecompile -q -p "$ZSH_COMPDUMP" && rm -f "$ZSH_COMPDUMP.zwc.old"
+
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for config_file ("$ZSH"/lib/*.zsh); do