Commit 1af74ea9edde7f3cec1f63068dc4f5aad2dcad68

Authored by Shrikant Sharat
1 parent f554ec3587

Load completions after bundles are loaded.

bundle-init is now renamed to bundle-apply and is to called after all bundle
specifications are given. Also added notes in the README file.

The reason is the compinit function needs to be run after adding all the
required directories to `fpath`. The only reliable and performant way to do it
would be to explicitly call a function that does it after specifying all the
bundles.

Showing 2 changed files with 18 additions and 2 deletions Side-by-side Diff

... ... @@ -32,6 +32,9 @@ might look like this
32 32 # Load the theme.
33 33 bundle-theme robbyrussell
34 34  
  35 + # Tell antigen that you're done.
  36 + bundle-apply
  37 +
35 38 Open your zsh with this zshrc and run `bundle-install` and you should be ready
36 39 to roll. The complete syntax for the `bundle` command is discussed further down
37 40 on this page.
... ... @@ -184,6 +187,20 @@ want to use.
184 187 Currently, themes are pulled from robbyrussell's oh-my-zsh repo, but it will
185 188 support getting themes from other repos as well in the future.
186 189  
  190 +## bundle-apply
  191 +
  192 +You have to add this command after defining all bundles you need, in your zshrc.
  193 +The completions defined by your bundles will be loaded at this step.
  194 +
  195 +It is possible to load completions as and when a bundle is specified with the
  196 +bundle command, in which case this command would not be necessary. But loading
  197 +the completions is a time-consuming process and your shell will start noticeably
  198 +slow if you have a good number of bundle specifications.
  199 +
  200 +However, if you're a zsh expert and can suggest a way so that this would not be
  201 +necessary, I am very interested in discussing it. Please open up an issue with
  202 +your details. Thanks.
  203 +
187 204 # Configuration
188 205  
189 206 The following environment variables can be set to customize the behavior of
... ... @@ -196,7 +196,7 @@ bundle-theme () {
196 196 bundle "$url" --name=$name.theme --loc=themes/$name.zsh-theme
197 197 }
198 198  
199   -bundle-init () {
  199 +bundle-apply () {
200 200 # Initialize completion.
201 201 if ! type compinit &>/dev/null; then
202 202 autoload -U compinit
... ... @@ -227,4 +227,3 @@ echo-non-empty () {
227 227 }
228 228  
229 229 -bundle-env-setup
230   -bundle-init