Make Zsh faster

This commit is contained in:
Sam A. 2022-09-18 21:39:08 +02:00
parent 55c00f5f9a
commit 7ec67fc7bc
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -10,14 +10,30 @@ for zfile in $ZDOTDIR/*.zsh; do
source $zfile source $zfile
done done
# Clone Antidote if necessary # Set variables for antidote
[[ -e $ZDOTDIR/.antidote ]] || git clone https://github.com/mattmc3/antidote.git $ZDOTDIR/.antidote antidote_dir="$ZDOTDIR/.antidote"
plugins_txt="$ZDOTDIR/.zsh_plugins.txt"
static_file="$ZDOTDIR/.zsh_plugins.zsh"
# Source Antidote # Clone antidote if necessary and generate a static plugin file
source $ZDOTDIR/.antidote/antidote.zsh if [[ ! $static_file -nt $plugins_txt ]]; then
[[ -e $antidote_dir ]] ||
git clone --depth=1 https://github.com/mattmc3/antidote.git $antidote_dir
(
source $antidote_dir/antidote.zsh
[[ -e $plugins_txt ]] || touch $plugins_txt
antidote bundle <$plugins_txt >$static_file
)
fi
# Generate and source plugins from $ZDOTDIR/.zsh_plugins.txt # Make antidote commands available
antidote load autoload -Uz $antidote_dir/functions/antidote
# Source the static plugins file
source $static_file
# Cleanup
unset antidote_dir plugins_file static_file
# Set p10k prompt # Set p10k prompt
autoload -Uz promptinit && promptinit && prompt powerlevel10k autoload -Uz promptinit && promptinit && prompt powerlevel10k