d
Amit DhamuSoftware Engineer
 

Managing Oh My Zsh Using Antigen

3 minute read 00000 views

Update

I'm now using Antibody to manage my ZSH configuration. You should check it out!

https://getantibody.github.io

Introduction

Oh-My-Zsh is a popular ZSH framework which includes a series of sensible configurations, helpful aliases and pretty themes. It is quite heavy though and although you are able to toggle which plugins you enable, the plugin architecture seems like it was an afterthought and not that nice by design. Enter Antigen.

Antigen

Antigen is a plugin manager for ZSH. It is inspired by Pathogen which is a plugin manager for Vim.

Now you're probably thinking YAGNI, Oh-My-Zsh does exactly what I want etc etc but I'd argue that having complete control of your setup with minimum config is very beneficial.

Get Started

This article assumes you're using zsh already and not bash.

# Backup existing .zshrcmv ~/.zshrc ~/.zshrc_backup

# Download Antigen into your home directorycurl -L git.io/antigen > ~/antigen.zsh

# Open up .zshrcvim ~/.zshrc

Now enter the following config in your ~/.zshrc file and save (basic config and useful plugins):

# Use antigen
source $HOME/antigen.zsh

# Use Oh-My-Zsh
antigen use oh-my-zsh

# Set theme
antigen theme robbyrussell

# Set plugins (plugins not part of Oh-My-Zsh can be installed using githubusername/repo)
antigen bundle git
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-syntax-highlighting

if [[ "$OSTYPE" == "darwin"* ]]; then
    antigen bundle osx
fi

# Apply changes
antigen apply

Finally source the changes to get your command line to recognise them:

source ~/.zshrc

Running this for the first time will install all of the plugins you've declared (which you'll see on the command line) and you should now have a "robbyrussell" ZSH prompt.

terminal.png

You can add plugins simply by adding them to your ~/.zshrc file and source'ing it again.

Of course, you don't have to use Oh-My-ZSH; just vanilla ZSH with selected plugins from Github should also work.

Further Reading