Permalink
Browse files

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.
  • Loading branch information...
sharat87 committed Mar 13, 2013
1 parent a8ea6fb commit a9ebdcdbec77e261ead63f7d326b3fb0791d170c
Showing with 15 additions and 11 deletions.
  1. +15 −11 antigen.zsh
View
@@ -9,7 +9,7 @@ local _ANTIGEN_INSTALL_DIR="$(dirname $0)"
# Used to defer compinit/compdef
typeset -a __deferred_compdefs
-compdef () { __deferred_compdefs=(${__deferred_compdefs} "${*}") }
+compdef () { __deferred_compdefs=($__deferred_compdefs "$*") }
# Syntaxes
# antigen-bundle <url> [<loc>=/]
@@ -399,13 +399,22 @@ antigen-theme () {
}
antigen-apply () {
+
# Initialize completion.
- local cd
- for cd in $__deferred_compdefs; do
- compdef $cd
- done
+ local cdef
+
+ # Load the compinit module. This will readefine the `compdef` function to
+ # the one that actually initializes completions.
+ autoload -U compinit
+ compinit -i
+
+ # Apply all `compinit`s that have been deferred.
+ eval "$(for cdef in $__deferred_compdefs; do

This comment has been minimized.

Show comment Hide comment
@wrboyce

wrboyce Mar 13, 2013

Contributor

What is the reason for doing this in an eval?

@wrboyce

wrboyce Mar 13, 2013

Contributor

What is the reason for doing this in an eval?

+ echo compdef $cdef
+ done)"
+
unset __deferred_compdefs
- compdef _antigen antigen
+
}
antigen-list () {
@@ -667,11 +676,6 @@ antigen () {
https://github.com/robbyrussell/oh-my-zsh.git
-set-default ADOTDIR $HOME/.antigen
- # Load the compinit module. Required for `compdef` to be defined, which is
- # used by many plugins to define completions.
- autoload -U compinit
- compinit -i
-
# Setup antigen's own completion.
compdef _antigen antigen

0 comments on commit a9ebdcd

Please sign in to comment.