Commit 5e23ab6fec6935fc10ae9b2242f1f73d56facd99

Authored by Will Boyce
Committed by Shrikant Sharat
1 parent 08e06125df

Defer `compdef` calls until after `compinit -i` is called

Conflicts:
	antigen.zsh

Showing 1 changed file with 10 additions and 3 deletions Side-by-side Diff

... ... @@ -7,6 +7,10 @@
7 7 local _ANTIGEN_BUNDLE_RECORD=""
8 8 local _ANTIGEN_INSTALL_DIR="$(dirname $0)"
9 9  
  10 +# Used to defer compinit/compdef
  11 +typeset -a __deferred_compdefs
  12 +compdef () { __deferred_compdefs[$(($#__deferred_compdefs+1))]=$* }
  13 +
10 14 # Syntaxes
11 15 # antigen-bundle <url> [<loc>=/]
12 16 # Keyword only arguments:
... ... @@ -392,9 +396,12 @@ antigen-theme () {
392 396  
393 397 antigen-apply () {
394 398 # Initialize completion.
395   - # TODO: Only load completions if there are any changes to the bundle
396   - # repositories.
397   - compinit -i
  399 + local cd
  400 + for cd in $__deferred_compdefs; do
  401 + compdef $cd
  402 + done
  403 + unset __deferred_compdefs
  404 + compdef _antigen antigen
398 405 }
399 406  
400 407 antigen-list () {