From fd90f64cc31ad6c13b4b1a95f78361481b03e06f Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Wed, 17 Jul 2024 10:31:39 -0400 Subject: [PATCH] Support zstyle to customize zsh-defer repo --- functions/__antidote_bulk_clone | 9 +++++++-- functions/antidote-script | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/functions/__antidote_bulk_clone b/functions/__antidote_bulk_clone index ba6292e..cf86835 100644 --- a/functions/__antidote_bulk_clone +++ b/functions/__antidote_bulk_clone @@ -4,8 +4,13 @@ #function __antidote_bulk_clone { emulate -L zsh; setopt local_options $_adote_funcopts + # Allow the user to define zsh-defer repo in case they want to fork it. + local zsh_defer_bundle + zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \ + || zsh_defer_bundle='romkatv/zsh-defer' + # get a list of clonable repos from a bundle file - $__adote_awkcmd ' + $__adote_awkcmd -v ZSH_DEFER_BUNDLE=$zsh_defer_bundle ' BEGIN { RS="[\r\n]" } # initialize vars @@ -15,7 +20,7 @@ /^ *(#.+)?$/ { next } # clone zsh-defer - /kind:defer/ { print "antidote-script --kind clone romkatv/zsh-defer &" } + /kind:defer/ { print "antidote-script --kind clone " ZSH_DEFER_BUNDLE " &" } # handle user/repo and URL forms $1~/^[^\/]+\/[^\/]+$/ { bundle=$1 } diff --git a/functions/antidote-script b/functions/antidote-script index 410aac6..aa78132 100644 --- a/functions/antidote-script +++ b/functions/antidote-script @@ -107,11 +107,14 @@ # handle defers local source_cmd="source" + local zsh_defer_bundle + zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \ + || zsh_defer_bundle='romkatv/zsh-defer' if [[ "$o_kind[-1]" == "defer" ]]; then source_cmd="${zsh_defer} source" script+=( 'if ! (( $+functions[zsh-defer] )); then' - "$(antidote-script 'romkatv/zsh-defer' | __antidote_indent)" + "$(antidote-script $zsh_defer_bundle | __antidote_indent)" 'fi' ) fi @@ -123,7 +126,7 @@ else script+=("fpath+=( ${bundle_path}/${o_autoload[-1]} )") fi - script+=( "builtin autoload -Uz \$fpath[-1]/*(N.:t)" ) + script+=("builtin autoload -Uz \$fpath[-1]/*(N.:t)") fi # generate load script