plug.zsh is an extremely simple zsh plugin manager (~60 LOC), pre-compiling plugins to avoid startup overhead.
It can install, update and remove plugins.

- Clone
plug.zshinto$ZDOTDIR(if setup in~/.zshenv) or any other preferred directory (eg:$HOME/.local/share/zsh). In this case, we shall proceed by using$ZDOTDIR. Ensure that the directory exists before cloning.
git clone https://codeberg.org/oceanicc/plug.zsh "$ZDOTDIR/plug" # or any other preferred directory- To setup
plug.zsh, add this snippet to.zshrc. You may set$ZDATADIRto any directory you prefer before callingplug-setup. If unset, it defaults to$XDG_DATA_HOME/zshor$HOME/.local/share/zsh.
plug-setup() {
: "${ZDATADIR:=${XDG_DATA_HOME:-$HOME/.local/share}/zsh}"
src="$ZDOTDIR/plug/plug.zsh" # or any other preferred directory
dir="$ZDATADIR/plug" dst="$dir/plug.zsh"
mkdir -p "$dir"
[ ! -e "$dir/plug.zwc" ] || [ "$src" -nt "$dst" ] && {
cp "$src" "$dst"
zcompile "$dir/plug.zwc" "$dst"
print -P "%F{green}✔ Compiled plug.zsh%f"
}
source "$dst"
}
# ZDATADIR="$HOME/.cache/zdata" # optionally override $ZDATADIR
plug-setupPlugins can be installed via plug-install. However, plugins must be sourced manually.
Example:
# install and compile plugins
plug-install https://github.com/zsh-users/zsh-syntax-highlighting
plug-install https://github.com/zsh-users/zsh-autosuggestions
plug-install https://github.com/romkatv/powerlevel10k
# source plugins
source "$ZDATADIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
source "$ZDATADIR/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$ZDATADIR/powerlevel10k/powerlevel10k.zsh-theme"
[ ! -f "$ZDOTDIR/.p10k.zsh" ] || source "$ZDOTDIR/.p10k.zsh"Plugins can be removed via plug-remove.
Make sure to remove any plug-install snippets for removed plugins from ~/.zshrc to prevent plug.zsh from re-installing them.
Example:
plug-remove zsh-syntax-highlighting
plug-remove zsh-autosuggestions
plug-remove powerlevel10kPlugins can be updated via plug-update.
Example:
plug-update zsh-syntax-highlighting
plug-update zsh-autosuggestions
plug-update powerlevel10kInstalled plugins can be viewed via plug-list.
plug-list