Commit a9ebdcdbec77e261ead63f7d326b3fb0791d170c
1 parent
a8ea6fb494
Don't load compinit module at startup.
Kills the whole purpose of the compdef deferrer function introduced in #37. Completions are now correctly deferred and applied when `antigen-apply` is called.
Showing 1 changed file with 15 additions and 11 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -9,7 +9,7 @@ local _ANTIGEN_INSTALL_DIR="$(dirname $0)" |
9 | 9 | |
10 | 10 | # Used to defer compinit/compdef |
11 | 11 | typeset -a __deferred_compdefs |
12 | -compdef () { __deferred_compdefs=(${__deferred_compdefs} "${*}") } | |
12 | +compdef () { __deferred_compdefs=($__deferred_compdefs "$*") } | |
13 | 13 | |
14 | 14 | # Syntaxes |
15 | 15 | # antigen-bundle <url> [<loc>=/] |
... | ... | @@ -399,13 +399,22 @@ antigen-theme () { |
399 | 399 | } |
400 | 400 | |
401 | 401 | antigen-apply () { |
402 | + | |
402 | 403 | # Initialize completion. |
403 | - local cd | |
404 | - for cd in $__deferred_compdefs; do | |
405 | - compdef $cd | |
406 | - done | |
404 | + local cdef | |
405 | + | |
406 | + # Load the compinit module. This will readefine the `compdef` function to | |
407 | + # the one that actually initializes completions. | |
408 | + autoload -U compinit | |
409 | + compinit -i | |
410 | + | |
411 | + # Apply all `compinit`s that have been deferred. | |
412 | + eval "$(for cdef in $__deferred_compdefs; do | |
413 | + echo compdef $cdef | |
414 | + done)" | |
415 | + | |
407 | 416 | unset __deferred_compdefs |
408 | - compdef _antigen antigen | |
417 | + | |
409 | 418 | } |
410 | 419 | |
411 | 420 | antigen-list () { |
... | ... | @@ -667,11 +676,6 @@ antigen () { |
667 | 676 | https://github.com/robbyrussell/oh-my-zsh.git |
668 | 677 | -set-default ADOTDIR $HOME/.antigen |
669 | 678 | |
670 | - # Load the compinit module. Required for `compdef` to be defined, which is | |
671 | - # used by many plugins to define completions. | |
672 | - autoload -U compinit | |
673 | - compinit -i | |
674 | - | |
675 | 679 | # Setup antigen's own completion. |
676 | 680 | compdef _antigen antigen |
677 | 681 |