Awesome Terminal upgrades - Part Three: Manage ZSH plugins using Zplugin
Tags: opensource, productivity, zsh, bash
Published: 2019-12-15 02:36:55

---
title: Awesome Terminal upgrades - Part Three: Manage ZSH plugins using Zplugin
published: true
description: Awesome Terminal upgrades - Part Three: Manage ZSH plugins using Zplugin
tags: opensource, productivity, zsh, bash
series: Awesome Terminal upgrades
---

Recently, I wrote an article about customising your shell using ZSH.

However, as one person pointed out in the comments, the startup time and performance was _excrucuatingly_ slow. 

So I set about making sure I chose a better ZSH manager this time around.

According to this [comparison of ZSH frameworks and plugin managers](https://gist.github.com/laggardkernel/4a4c4986ccdcaf47b91e8227f9868ded), if you're using any plugins and doing _any sort of development_, [Zplugin](http://zdharma.org/zplugin/wiki/INTRODUCTION/) is the only option to consider, especially if you use tools like [thefuck](https://dev.to/misterf/awesome-terminal-upgrades-part-five-install-awesome-and-productive-command-line-tools-4cd0#thefuck) for example.

It turns out, Zplugin is hands down the fastest most performant ZSH plugin manager, beating Oh-My-ZSH, Antigen, Zplug, Prezto and so on.

![zplugin startup times](https://raw.githubusercontent.com/zdharma/pm-perf-test/master/plots/startup-times.png)

Zplugin launches in *< 1 second (~50ms)* as opposed to *> 8 seconds* which I was experiencing whilst using zplug!

## Install [Homebrew](https://brew.sh/)
> The missing package manager for macOS (or Linux)

We will be using Homebrew to manage everything for us, if you don't have it installed, go ahead and do it now!

```
echo “[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion” >> ~/.bash_profile
```

## Install [Zplugin](https://github.com/zdharma/zplugin)

```
brew install zplugin
```
Zplugin will dump some lines of code into your `.zshrc` file:

```
source "$HOME/.zplugin/bin/zplugin.zsh"
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
```
### Install some plugins to get up and running

Once the above output is added to you `.zshrc`, we can leverage [Oh-My-ZSH](https://github.com/ohmyzsh/ohmyzsh)'s [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) and add some functionality and shortcuts. We'll add Git and SSH to keep it shoer, we'll add some auto suggestion and completion features as well.

We reference OMZ plugins with `zplugin snippet OMZ::` followed by the path to the zsh command eg `ssh-agent/ssh-agent.plugin.zsh` to make `zplugin snippet OMZ::ssh-agent/ssh-agent.plugin.zsh`.

Here is a more fleshed out example:


```
zplugin ice blockf
zplugin light zsh-users/zsh-completions

zplugin ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX"

zplugin ice wait lucid atload'_zsh_autosuggest_start'
zplugin light zsh-users/zsh-autosuggestions

zplugin snippet OMZ::plugins/git/git.plugin.zsh
zplugin snippet OMZ::plugins/ssh-agent/ssh-agent.plugin.zsh
```
After you've done this you will want to source your `.zshrc` file again:

```
source ~/.zshrc
```

And voila! You're all done, ready and up and running!

Here is what my own `.zshrc` file looks like:

{% gist https://gist.github.com/Demwunz/e98777abeee1bd1e6ac74f7a9827a97e %}