1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-18 20:00:07 +00:00

core: refresh zcompdump cache file in init script (#8878)

This commit is contained in:
Marc Cornellà 2020-05-04 16:51:16 +02:00 committed by GitHub
parent 173d4ca68f
commit dd1a72696f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,6 +61,18 @@ if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi fi
# Construct zcompdump OMZ metadata
zcompdump_metadata="\
#omz revision: $(cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
#omz fpath: $fpath\
"
# Delete the zcompdump file if OMZ zcompdump metadata changed
if ! cmp -s <(command grep '^#omz' "$ZSH_COMPDUMP" 2>/dev/null) <<< "$zcompdump_metadata"; then
command rm -f "$ZSH_COMPDUMP"
zcompdump_refresh=1
fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
source $ZSH/lib/compfix.zsh source $ZSH/lib/compfix.zsh
# If completion insecurities exist, warn the user # If completion insecurities exist, warn the user
@ -72,6 +84,13 @@ else
compinit -u -C -d "${ZSH_COMPDUMP}" compinit -u -C -d "${ZSH_COMPDUMP}"
fi fi
# Append zcompdump metadata if missing
if (( $zcompdump_refresh )); then
echo "\n$zcompdump_metadata" >>! "$ZSH_COMPDUMP"
fi
unset zcompdump_metadata zcompdump_refresh
# Load all of the config files in ~/oh-my-zsh that end in .zsh # 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 # TIP: Add files you don't want in git to .gitignore