www-gem words

[Plugin] Manage your plugins without a plugins manager

Published on

zsh zsh power an be extended by the use of plugins. Whenever you talk about plugins, you need to think about which plugins manager to use. Like for other tools using plugins, there are various flavor of plugins managers but with zsh there is an alternative option: not using a plugins manager .

I went this route to stay within the KISS (Keep It Simple Stupid) spirit but also to avoid having to rely on one additional tool. If this can sounds scary at first, it may actually be easier than using a plugins manager. All you have to do is to add this to your .zshrc:

# where do you want to store your plugins?
ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}

# get zsh_unplugged and store it with your other plugins
if [[ ! -d $ZPLUGINDIR/zsh_unplugged ]]; then
  git clone --quiet https://github.com/mattmc3/zsh_unplugged $ZPLUGINDIR/zsh_unplugged
fi
source $ZPLUGINDIR/zsh_unplugged/zsh_unplugged.zsh

# make list of the Zsh plugins you use
repos=(
  # plugins that you want to load (in order from first to last)
  maintainer/package
)

# now load your plugins
plugin-load $repos

To update your plugins, simply run this command (add an alias for it in your .zshrc):

ZPL=~/.config/zsh/plugins; rm -rfi $ZPLUGINDIR; zsh

(previous readers of this blog would have noticed that I used the command rm here but my actual command relies on trash-put

Now, your plugins are basically folders in your $ZPLUGINDIR. Hence, getting rid of one is as simple as removing it from the list in your .zshrc and removing the directory in $ZPLUGINDIR.


Thanks for your read. Hope it's been useful to you.


Interact with this post using Mastodon or

Comment on wwwgem's post

Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.

✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈

More food for thoughts? Check other posts about: #Zsh #Zsh-Plugins