omz-pnpm
July 7, 2026 · View on GitHub
An oh-my-zsh plugin for pnpm. Two jobs:
- A small set of aliases for the commands you actually type.
- Completion that includes
package.jsonscripts. The officialpnpm install-completion zshscript wires uppnpm completion-server, which handles built-in subcommands and flags but doesn't offer scripts at the barepnpm <TAB>prompt and doesn't show script bodies as descriptions. This plugin layers both on top.
Install
git clone https://github.com/bgowers/omz-pnpm "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/pnpm"
Then add pnpm to the plugins=( … ) array in ~/.zshrc and start a new
shell. If you previously ran pnpm install-completion zsh, remove the
source …completion-for-pnpm.zsh line — this plugin replaces it.
Aliases
| Alias | Expands to | Notes |
|---|---|---|
p | pnpm | |
pi | pnpm install | Matches npm i. (pnpm i is also built-in.) |
pa | pnpm add | |
pad | pnpm add --save-dev | |
prm | pnpm remove | |
pr | pnpm run | |
pd | pnpm dev | pnpm forwards unmatched first args to scripts. |
pb | pnpm build | |
pt | pnpm test | |
pf | pnpm --filter | For workspaces. Append the package selector + command. |
pdlx | pnpm dlx | |
pex | pnpm exec |
Completion
pnpm <TAB>— built-in subcommands and package.json scripts.pnpm run <TAB>— package.json scripts, with the script body shown as the description (e.g.dev next dev).pnpm remove <TAB>(andrm/uninstall/un) — packages currently listed independencies,devDependencies,peerDependencies, oroptionalDependencies.- Everything else — flags, install options, etc. — falls through to the
official
pnpm completion-server.
The package.json is found by walking up from the current directory, so it
works the same whether you're at the repo root or three levels deep.
How it works
pnpm install-completion zsh writes a small wrapper that calls
pnpm completion-server over the tabtab
protocol. The plugin's _pnpm function does the same call, but then:
- merges in
package.jsonscripts at the bare-pnpmposition (sopnpm de<TAB>→dev), - replaces the server's script list at
pnpm runwith one that includes command bodies as descriptions, - adds an installed-packages list for
pnpm remove.
It uses jq if available, falling back to node. Both produce the same
output; jq is faster.
License
MIT