HN: Μz – a micro zsh plugin manager still going strong after 5 years

maxrodrigo1 pts0 comments

GitHub - maxrodrigo/uz: μz - a micro manager you won't hate · GitHub

/" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

maxrodrigo

uz

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>15

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>21 Commits<br>21 Commits

.github/workflows

.github/workflows

test

test

.gitignore

.gitignore

LICENSE

LICENSE

Makefile

Makefile

README.md

README.md

uz.zsh

uz.zsh

View all files

Repository files navigation

/$$ /$$ /$$$$$$$$<br>| $$ | $$|____ /$$/<br>| $$ | $$ /$$$$/<br>| $$ | $$ /$$__/<br>| $$$$$$$/ /$$$$$$$$ zsh micro plugin manager<br>| $$____/ |________/<br>| $$<br>| $$<br>\_$

Installation

Git

Clone from GitHub and source uz.zsh.

git clone https://github.com/maxrodrigo/uz.git ~/.uz

# ~/.zshrc<br>source ~/.uz/uz.zsh

To update, git -C ~/.uz pull.

Homebrew

brew install maxrodrigo/tap/uz

# ~/.zshrc<br>source $(brew --prefix)/share/uz/uz.zsh

To update, brew upgrade uz.

Usage

Add Plugins

Add plugins' Github repo to .zshrc with zadd. Plugins are automatically installed on load.

zadd zsh-users/zsh-syntax-highlighting<br>zadd zsh-users/zsh-completions

By default µz sources init.zsh or plugin_name.(zsh|plugin.zsh|zsh-theme|sh) but you can also specify another script to the zadd command as follows:

zadd username/repo script_name

Manage Plugins

zclean: removes plugins no longer in .zshrc.

zupdate: update installed plugins.

Installation Path

By default plugins are installed into ${XDG_DATA_HOME:-~/.local/share}/uz/plugins,<br>independent of where uz.zsh itself is installed from — this matters if it's<br>managed by a package manager that replaces its install directory on every<br>upgrade (see Homebrew). This behavior can be changed re-setting UZ_PLUGIN_PATH.

Plugins are namespaced by owner (${UZ_PLUGIN_PATH}/owner/repo), so two<br>different forks of the same repo name never collide. Upgrading from an older<br>μz that installed plugins flat, or at the old default path next to uz.zsh,<br>migrates each one automatically on its next zadd — no re-clone, existing<br>.git history and compiled .zwc are kept.

export UZ_PLUGIN_PATH=${XDG_DATA_HOME:-$HOME/.local/share}/uz/plugins # default

Example

# ~/.zshrc<br>source ~/.uz/uz.zsh

zadd maxdrorigo/gitster<br>zadd maxrodrigo/zsh-kubernetes-contexts<br>zadd zsh-users/zsh-syntax-highlighting<br>zadd zsh-users/zsh-history-substring-search<br>zadd zsh-users/zsh-completions

Requirements

zsh

git

Uninstall

Git

μz only creates folders for the cloned modules and, by default, are self contained into the installation directory.

To uninstall remove the installation directory ($UZ_PATH) and the modules folder ($UZ_PLUGIN_PATH) if applicable.

Homebrew

brew uninstall uz

Plugins live outside the formula's install directory (see Installation<br>Path), so uninstalling doesn't remove them; delete<br>$UZ_PLUGIN_PATH too if applicable.

Other Notes

Testing

test/.zshrc sources this repo's own uz.zsh into an isolated<br>UZ_PLUGIN_PATH (test/plugins, gitignored), so changes can be verified<br>without touching your real dotfiles:

ZDOTDIR=$PWD/test zsh -i

First run clones the plugins listed in test/.zshrc; edit that file to add<br>more. Delete test/plugins to start clean.

Releasing

make release

Tags and pushes a new version, then points the Homebrew formula<br>at it — downloads the tag's tarball, recomputes its checksum, and pushes the<br>update straight to maxrodrigo/tap. No CI, no per-platform builds; uz is<br>one portable script. Run make brew VERSION=vX.Y.Z alone to repoint the<br>formula without cutting a new release.

Updating benchmark

ls -d ${UZ_PLUGIN_PATH}/*/.git<br>0.00s user 0.00s system 77% cpu 0.002 total

find $UZ_PLUGIN_PATH -type d -name .git -prune<br>0.01s user 0.00s system 95% cpu 0.006 total

find $UZ_PLUGIN_PATH -type d -exec test -e '{}/.git' \; -print0<br>0.19s user 0.09s system 100% cpu 0.286 total

Compile benchmark

zadd compiles each sourced script to bytecode (.zwc) via zcompile, so<br>every following shell loads it instead of re-parsing text. Sourcing<br>zsh-autosuggestions.zsh (867 lines) 500 times, with and without its .zwc:

source zsh-autosuggestions.zsh # with .zwc<br>0.06s user 0.03s system 99% cpu 0.092 total

source zsh-autosuggestions.zsh # without .zwc<br>0.25s user 0.07s system 99% cpu 0.315 total

About<br>μz - a micro manager you won't hate<br>Topics<br>antigenclicommand-lineframeworkoh-my-zshplugin-managerzshzsh-pluginzshrc<br>Resources<br>Readme<br>MIT license<br>Activity<br>Stars<br>15 stars<br>Watchers<br>0 watching<br>Forks<br>5 forks<br>Report repository

Releases

Packages

Used by

Contributors

Languages

You can’t perform that action at this time.

plugins zadd uz_plugin_path test github zshrc

Related Articles