Published 08-23-2023
Zap is a very lightweight (172 kb) plugin manager for Zsh. If you’re looking to improve your terminal usage but don’t know where to start, or if you have a zsh config but it’s a bloated unorganized mess (hey that’s me). Zap is a great choice to hit the ground running or clean things up.
Relevant Links
As a prerequisite, you need zsh. It’s also ideal to have Nerd Fonts.
To install, run the following command in your terminal. This archives any existing .zshrc
& creates a new one using zap
zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1
Moved .zshrc to .zshrc_2023-08-23_1692809128
Zapped
Find more plugins at https://zapzsh.com
⚡ Zap installed zsh-autosuggestions
⚡ Zap installed supercharge
⚡ Zap installed zap-prompt
⚡ Zap installed zsh-syntax-highlighting
After installing (you may need to restart your terminal). By default, the zap-prompt
and a few other features like syntax highlighting and autocompletion are already configured.
Navigate to your .zshrc
file. If you’re already a zsh user, you may recognize some of these plugins. Zap makes it easy to install common plugins in the zsh ecosystem
Any additional config you want to add will also go here in your .zshrc
# Created by Zap installer
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
plug "zsh-users/zsh-autosuggestions"
plug "zap-zsh/supercharge"
plug "zap-zsh/zap-prompt"
plug "zsh-users/zsh-syntax-highlighting"
# Load and initialise completion system
autoload -Uz compinit
compinit
Zap Outlet lists a ton of compatible plugins.
To add a plugin, simply add plug "user/repository"
to your .zshrc
.
Personally, I love plug "MAHcodes/distro-prompt"
. This allows me to assert my dominance in the tech bro hierarchy by showing that I use Arch literally every time I open my terminal.
You can also use zap to load your own custom plugins or .zsh
files. In my case, migrating to zap took less than a minute because I moved all of my aliases and exports over like this
# Community plugin
plug "MAHcodes/distro-prompt"
# Example of a local plugin
plug "$HOME/plugins/my-custom-prompt"
# My existing .zsh files
plug "$HOME/.config/zsh/zsh-aliases"
plug "$HOME/.config/zsh/zsh-exports"
zap list
+ zap clean
can be used to see what plugins you’re using and remove any that are unused. For example, after switching from zap-prompt
to distro-prompt
$ zap list
⚡ Zap - List
1 🔌 zsh-autosuggestions
2 🔌 supercharge
3 🔌 zsh-syntax-highlighting
4 🔌 distro-prompt
$ zap clean
⚡ Zap - Clean
✅ Removed zap-prompt
Updating
zap update self # Update the Zap installation
zap update plugins # Update all your plugins but not Zap
zap update all # Update both the Zap installation and its plugins
I really like and highly recommend Zap. I always worry about bringing in new dependencies or removing old ones because these things can tend to spiral. What should take minutes, may even take hours. That’s not the case with Zap. It was incredibly easy to setup (literally less than 5 minutes to have my whole setup working) and it’s cool to know it has virtually no overhead or bloat.