DC* edited this page Nov 16, 2017 · 13 revisions

Plugin development

In order to develop and load a plugin with Antigen you should configure the plugin as follows:

# Pass --no-local-clone to antigen's bundle to tell antigen to load the plugin
# from /path/to/plugin rather than cloning it
antigen bundle /path/to/plugin --no-local-clone

# Don't forget to tell antigen that you're done
antigen apply

Use antigen theme in the case you're developing a theme rather than a bundle.

If your bundle do use compinit in some way remember to always refresh your .zcompdump file. The easiest way is to run:


Static bundle loading

If you need to load Antigen faster you may load bundles statically from cache. This way you can avoid loading and running Antigen each time you shell starts.

Note: This will be unnecessary for 2.x (current develop) as this will be performed by Antigen itself.

Example .zshrc:

# If there is cache available
if [[ -f ${ADOTDIR:-$HOME/.antigen}/.cache/.zcache-payload ]]; then
    # Load bundles statically
    source ${ADOTDIR:-$HOME/.antigen}/.cache/.zcache-payload

    # You will need to call compinit
    autoload -Uz compinit
    compinit -d ${HOME}/.zcompdump
    # If there is no cache available do load and execute antigen
    source $ANTIGEN/antigen.zsh

    # I'm using antigen-init here but your usual antigen-bundle,
    # antigen-theme, antigen-apply will work as well
    antigen init $ZSH_CUSTOM/.antigenrc

This way you can greatly improve performance. It's unnecessary on Antigen v2 and above as Antigen do lazy-load itself and uses cache when available, plus compiling cache as well.

Init command

Use this command to load antigen configuration. Example set up:


source antigen.zsh
antigen init .antigenrc


antigen use oh-my-zsh

antigen bundle ...
antigen theme ...

antigen apply

This setup further improves cache performance (~0.02s). One caveat: antigen-init command doesn't look into bundle configuration changes, thus you'll need to use antigen-reset to reload plugins.

Configure compdump location

Use ANTIGEN_COMPDUMPFILE to configure zsh compdump file location:


export ANTIGEN_COMPDUMPFILE=/path/to/location/.zcompdump

Note: On Antigen v2 and above this configuration is ANTIGEN_COMPDUMP.

Configure custom default library

Antigen supports Oh-My-Zsh and Prezto by default. So you can easily manage bundles from those libraries, this way:


antigen use oh-my-zsh
antigen bundle git-extras
antigen theme agnoster
antigen apply

Both git-extras and agnoster theme are going to be used from Oh-My-Zsh repository. This work for Oh-My-Zsh and Prezto in the same way.

If you have a Oh-My-Zsh or Prezto fork and you naturally will prefer to use this fork instead. With Antigen it's easy to do that, with a simple configuration:




antigen bundle git-extras
antigen apply

In this example git-extras will be loaded from custom/oh-my-zsh repository, instead of the canonical one.

You can also use a custom library url as follow:


antigen use
antigen bundle git
antigen apply

Here, git bundle will be loaded from custom/library library.

Adding Antigen to your dotfiles

If you already have a dotfiles repo you may add Antigen to it as a submodule, as to be able to update it via git.

Add it to your dotfiles repository, in this example located at ~/.dotfiles:

cd ~/.dotfiles
git submodule add antigen

Configure your .zshrc file:

source $ANTIGEN_PATH/antigen/antigen.zsh

In order to update antigen do the following:

cd ~/.dotfiles/antigen
git pull
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.