diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 595c899..803cc9d 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -10,14 +10,30 @@ for zfile in $ZDOTDIR/*.zsh; do source $zfile done -# Clone Antidote if necessary -[[ -e $ZDOTDIR/.antidote ]] || git clone https://github.com/mattmc3/antidote.git $ZDOTDIR/.antidote +# Set variables for antidote +antidote_dir="$ZDOTDIR/.antidote" +plugins_txt="$ZDOTDIR/.zsh_plugins.txt" +static_file="$ZDOTDIR/.zsh_plugins.zsh" -# Source Antidote -source $ZDOTDIR/.antidote/antidote.zsh +# Clone antidote if necessary and generate a static plugin file +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 -antidote load +# Make antidote commands available +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 autoload -Uz promptinit && promptinit && prompt powerlevel10k