uz: A Zsh Micro Manager You Won't Hate
/$$ /$$ /$$$$$$$$
| $$ | $$|____ /$$/
| $$ | $$ /$$$$/
| $$ | $$ /$$__/
| $$$$$$$/ /$$$$$$$$
| $$____/ |________/
| $$
| $$
\_$
There’s something about the UNIX philosophy that gets lost when tools, whether for UX or GitHub stars, try to do too much.
Although I’m not big on ricing, my dotfiles have been with me for more than a decade now and managing them matters. For zsh plugin managers there are options: oh-my-zsh, antigen, or antibody. Each solved something but added its own overhead.
What I needed was simple: clone plugins from GitHub, source them, and occasionally update or clean up unused ones.
uz - a micro manager you won’t hate. Under 40 lines.
Contributions and feedback are welcome on GitHub.
Installation
git clone https://github.com/maxrodrigo/uz.git ~/.uz
# ~/.zshrc
source ~/.uz/uz.zsh
Usage
Add plugins with zadd. They’re cloned automatically on first load.
zadd zsh-users/zsh-syntax-highlighting
zadd zsh-users/zsh-completions
zadd zsh-users/zsh-history-substring-search
By default, uz sources init.zsh or plugin_name.(zsh|plugin.zsh|zsh-theme|sh). For plugins with non-standard entry points:
zadd username/repo custom-script.zsh
Managing Plugins
Update all installed plugins:
zupdate
Remove plugins no longer in your .zshrc:
zclean
How It Works
The entire plugin manager is a single function that checks if a directory exists, clones it if not, and sources the right file.
zadd() {
local zmodule=${1:t} zurl=${1} zscript=${2}
local zpath=${UZ_PLUGIN_PATH}/${zmodule}
if [[ ! -d ${zpath} ]]; then
mkdir -p ${zpath}
git clone --recursive https://github.com/${zurl}.git ${zpath}
fi
local zscripts=(${zpath}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
if [[ -f ${zpath}/${zscript} ]]; then source ${zpath}/${zscript}
elif [[ -f ${zscripts} ]]; then source ${zscripts}
fi
}
Plugins install to ~/.uz/plugins by default. Override with UZ_PLUGIN_PATH if needed.
Uninstall
Everything is self-contained. Remove the installation directory:
rm -rf ~/.uz