Table of contents
Antigen is dead
Antigen was the quasi-standard plugin manager for ZSH. It’s been around for a long time, provided a nice user experience and helped me build a solid, effortless ZSH plugin config. But it’s kind of abandoned now. The last commit was in 2019, and the last release was in 2018. While this is not a problem per se, as once set up everything still works fine, the competition has long since surpassed Antigen in terms of features and usability. Other solutions have become more popular and faster, and Antigen is no longer the solution of choice when building a new ZSH config.
Long live Antidote
There is a long list of alternatives to Antigen, as discussed in the Is this project dead? issue in Antigen’s GitHub repository. Antidote stands out here because it was explicitly created as a successor to Antibody (a derivative of Antigen), as the author also states in Antidote’s README :
Antidote is a feature-complete Zsh implementation of the legacy Antibody plugin manager, which in turn was derived from Antigen Antigen.
This gave me high hopes that a migration could be done with minimal effort. And indeed, it was a piece of cake. Here’s how I did it.
The migration
Before I start with the migration steps, I need to tell you how I configured and used Antigen, as the plugin manager was quite open to different setups. Depending on this, the migration may require more or less work than in my case. However, it should still be pretty straightforward - I mean, we are talking about a plugin manager that pulls Git repos here.
My Antigen setup
I installed Antigen via Homebrew and added the following configuration to my .zshrc:
.zshrczsh# Enable Antigensource $HOMEBREW_PREFIX/share/antigen/antigen.zsh# Load Antigen configuration# ´antigen init´ command doesn't look into bundle configuration changes,# thus ´antigen reset´ is needed to reload pluginsantigen init ~/.antigenrc
As you can see, I used the init command to speed up load times by improving the cache performance. It had some drawbacks, like having to call antigen reset after changing the bundle configuration, but since I didn’t change my plugin setup that often, it was fine for me. To use this command, a separate configuration file had to be created to hold the actual plugin configuration:
.antigenrczsh# ´antigen init´ command doesn't look into bundle configuration changes,# thus ´antigen reset´ is needed to reload pluginsantigen use oh-my-zshantigen bundles <<EOBUNDLESfzfautojumpdirhistorybgnotifygitsudosdkgradlenpmyarndockerdocker-composedocker-machinegcloudzsh-users/zsh-completionszsh-users/zsh-autosuggestionszsh-users/zsh-syntax-highlightinggrigorii-zander/zsh-npm-scripts-autocomplete@mainredxtech/zsh-yupntnyq/omz-plugin-pnpm --branch=mainEOBUNDLESantigen theme romkatv/powerlevel10kantigen apply
If your configuration is similar, you can follow the steps below to migrate to Antidote.
Antigen out, Antidote in
First, remove Antigen from your system. If you installed it via Homebrew, you can do this with the following command:
zshbrew rm antigen
Then you can install Antidote :
zshbrew install antidote
Migrate the zsh configuration
Remove the sourcing of Antigen and the antigen init command from your .zshrc. Instead, we now need to source Antidote and initialise the Antidote plugins.
.zshrczsh# Enable Antidotesource $HOMEBREW_PREFIX/opt/antidote/share/antidote/antidote.zsh# Initialize Antidote plugins statically with ${ZDOTDIR:-~}/.zsh_plugins.txtantidote load
Migrate the plugin configuration
The plugin configuration is now stored in a file called .zsh_plugins.txt. This file should be created either in your home directory or in the directory specified by the ZDOTDIR environment variable, if it’s set. A few things work differently here than in Antigen:
- It’s a simple text file with plugins listed on each line
- You can use comments by prefixing a line with
# - Empty lines are skipped
- You can use annotations, which I will explain below
- Antidote uses the file to generate a static
.zsh_plugins.zshfile, which is then sourced in the.zshrc
.zsh_plugins.txttxtromkatv/powerlevel10kzsh-users/zsh-completionsbelak/zsh-utils path:completionohmyzsh/ohmyzsh path:libohmyzsh/ohmyzsh path:plugins/fzfohmyzsh/ohmyzsh path:plugins/autojumpohmyzsh/ohmyzsh path:plugins/dirhistoryohmyzsh/ohmyzsh path:plugins/bgnotifyohmyzsh/ohmyzsh path:plugins/gitohmyzsh/ohmyzsh path:plugins/sudoohmyzsh/ohmyzsh path:plugins/sdkohmyzsh/ohmyzsh path:plugins/gradleohmyzsh/ohmyzsh path:plugins/npmohmyzsh/ohmyzsh path:plugins/yarnohmyzsh/ohmyzsh path:plugins/gcloudgrigorii-zander/zsh-npm-scripts-autocompleteredxtech/zsh-yupntnyq/omz-plugin-pnpmzsh-users/zsh-syntax-highlightingzsh-users/zsh-autosuggestions
Antidote doesn’t support Antigen’s commands, but you can use annotations to achieve the same result. Annotations are added at the end of a plugin line, separated by a space. The annotation path allows you to specify the subdirectory where the plugin is located, which is particularly useful for frameworks, and is used here for belak/zsh-utils and ohmyzsh/ohmyzsh. There are also other annotations which can be found in the Antidote documentation .
There are a lot of helpful comments in the sample Zsh config , which I recommend you take a look at. They can help you with the migration and also give you an idea of what else you can do with Antidote and ZSH plugins in general.
