I’d already worked with default plain shell for quite a long time until I recognized that I couldn't face that “ugly and boring guy” every day anymore. Being a developer, I spend time working with shell more than with any of my relatives including my mom, my girlfriend, or my roommate. Therefore, I need a better partner:
- It should be beautiful so that I feel comfortable looking at it for hours every day.
- It should be powerful and smart so that it can help me do things faster and more conveniently.
- It should be stable otherwise I won’t be able to work until it’s fixed.
- It should be configurable and extensible so that I can add or remove some features easily.
👉🏻 After a while researching and experimenting around available tools, I found out that Zsh + Antigen + Oh my Zsh really meet my expectation and is the best solution so far.
The Z shell (Zsh) is an extended Unix shell with many improvements, including some features of [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell), ksh, and tcsh.
The Zsh itself is neither beautiful nor smart but it enables extensibility so that community-developed plugins can be applied to make it beautiful and powerful.
The Zsh is so popular that it’s published to the package repository of almost all Unix distributions (Ubuntu, Centos, macOS, etc) so that you can easily install Zsh using your package manager:
# Ubuntu sudo apt-get install -y zsh # CentOS sudo yum install -y zsh # macOS (since macOS Catalina, Zsh has been installed with the OS) brew install zsh
As we said, Zsh enables pluggability so that users can install plugins and extend its features. However, Zsh itself does not provide a good plugin management mechanism, including fetch, install, update, remove plugins, etc.
Fortunately, Antigen takes this responsibility very well. Most Zsh plugins are published in the form of git repositories. Antigen allows us to simply specify a remote repository's path, then it will automatically fetch and install on the first run. Antigen also provides commands to update and remove plugins easily.
First, download Antigen, simply run:
curl -L git.io/antigen > antigen.zsh
Then, paste the following lines into your
~/.zshrc (if you didn’t have the file, create one):
# Load Antigen source "/path-to-your/antigen.zsh" # Load Antigen configurations antigen init ~/.antigenrc
~/.antigenrc will be your Antigen configuration file, where plugins and themes are listed.
Following is my
# Load oh-my-zsh library antigen use oh-my-zsh # Load bundles from the default repo (oh-my-zsh) antigen bundle git antigen bundle command-not-found antigen bundle docker # Load bundles from external repos antigen bundle zsh-users/zsh-completions antigen bundle zsh-users/zsh-autosuggestions antigen bundle zsh-users/zsh-syntax-highlighting # Select theme antigen theme denysdovhan/spaceship-prompt # Tell Antigen that you're done antigen apply
Skip the line
antigen use oh-my-zsh for now, we’ll talk about that in the next section.
To specify a plugin you want to apply:
antigen bundle remote-repo/url
zsh-users/zsh-autosuggestions actually point to
github.com/zsh-users/zsh-autosuggestions. Github is inferred automatically, if the repositories are hosted under a different domain, just specify the domain.
To apply a theme, use
antigen theme remote-repo/url.
Finally, you need to have the line
antigen apply to freeze and apply all previous configurations.
I’ve just used several plugins, you can find other awesome ones here.
Oh my Zsh
Oh my Zsh is a Zsh configuration framework, which embeds a bunch of plugins and themes so that you can turn them on and off easily.
You can easily use Oh my Zsh with Antigen by adding
antigen use oh-my-zsh to your
Then, to turn on a plugin or use a theme from Oh my Zsh:
# Turn on an Oh my Zsh plugin antigen bundle plugin-name antigen bundle git antigen bundle command-not-found antigen bundle docker # Apply an Oh my Zsh theme antigen theme theme-name antigen theme robbyrussell
Refer to the following links for a full list of Oh my Zsh plugins and themes.
Hope you like Zsh, too! If you like the article, let's connect on Twitter and exchange fun programming ideas together. 😉
Top comments (4)
I use zsh and oh-my-zsh but didn't know of antigen, thanks for the detailed tutorial!
Glad that it helps! Antigen is super handy!
I love zsh and didn't know about antigen.
Sounds pretty useful.
I am developing a lot within Containers lately. And I made a Docker image that is pre-configured to use the and oh-my-zsh.
Maybe I'll update it with some antigen plugins. :-)
very good combination! tks