>_ZSH-EXPAND
Intercepts your spacebar and expands everything in its path. Regular aliases, global aliases, suffix aliases, misspellings, globs, history, parameters. No pipes. No external commands. Pure zsh. Sub-millisecond. 11,683 tests.
Install
# Zinit (recommended)
zinit ice lucid nocompile
zinit load MenkeTechnologies/zsh-expand
# Oh My Zsh
git clone https://github.com/MenkeTechnologies/zsh-expand \
"$HOME/.oh-my-zsh/custom/plugins/zsh-expand"
# then: plugins+=(zsh-expand)
# Manual
git clone https://github.com/MenkeTechnologies/zsh-expand
source zsh-expand/zsh-expand.plugin.zsh
Neural expansion core
| Alias expansion | regular aliases in command position and after sudo/env/builtin/command/exec/eval/noglob/nocorrect/nice/nohup/rlwrap/time — with full flag support |
| Global alias | global aliases expanded anywhere on the command line |
| Spelling correction | 290+ built-in corrections, user-extensible via associative array |
| Native expansion | globs, $params, $(cmd), =(...), !history |
| Tabstop snippets | aliases with $ZPWR_TABSTOP placeholders — cursor jumps to placeholder |
| Self-ref escape | alias git="hub" expands to \hub — no infinite recursion |
| Correct-then-expand | typo correction chains into alias expansion in one keypress |
| Quote-aware expansion | optional expansion inside "double" / 'single' quoted args |
| Suffix alias | file.txt<space> → vim file.txt via alias -s |
| Autopair integration | delegates space insertion to zsh-autopair when present |
| History injection | optionally writes the fully-expanded form into history |
| Debug widget | Ctrl+\ shows parser state without modifying the line |
| Expansion preview | ghost text shows pending expansion before space is pressed |
| Expansion stats | zpwrExpandStats renders a cyberpunk dashboard with bar charts |
Examples
gco<space> => git checkout sudo gco<space> => sudo git checkout teh<space> => the su -l root gco<space> => su -l root git checkout stdbuf -oL gco<space> => stdbuf -oL git checkout strace -e trace=network gco<space> => ...git checkout file.txt<space> => vim file.txt (suffix alias)
Configuration matrix
# core export ZPWR_EXPAND=true # alias expansion in first position export ZPWR_EXPAND_SECOND_POSITION=true # alias expansion after sudo/env export ZPWR_EXPAND_NATIVE=true # expand globs, history, $params # correction export ZPWR_CORRECT=true export ZPWR_CORRECT_EXPAND=true # quotes export ZPWR_EXPAND_QUOTE_DOUBLE=true export ZPWR_EXPAND_QUOTE_SINGLE=false # history / suffix / preview / blacklist export ZPWR_EXPAND_TO_HISTORY=false export ZPWR_EXPAND_SUFFIX=true export ZPWR_EXPAND_PREVIEW=false export ZPWR_EXPAND_BLACKLIST=(g gco)
Key bindings
Space | Supernatural expand + insert space |
Ctrl+Space | Insert literal space (bypass) |
Ctrl+Opt+E | Debug widget — show parser state without expanding |
Versus the competition
The README contains a full 21-row comparison matrix vs zsh-abbr, zsh-abbrev-alias, and OMZ globalias. zsh-expand is the only plugin in that set that supports prefix-command parsing with flag awareness, suffix aliases, tabstop snippets, self-referential escape, correct-then-expand, history injection, live preview, and case-insensitive prefix matching — with 11,683 tests vs no test suite on two of the three.
Performance
Apple Silicon, 10,000 iterations: file.txt suffix alias ~31 µs; sudo file.txt prefix+suffix ~130 µs; gco regular alias ~36 µs. Human perception threshold is ~100 ms — these are 770-3200x below it. Hot path uses zero external commands and zero subshells.
Sibling plugins
Part of the MenkeTechnologies zsh plugin family — the MenkeTechnologiesMeta umbrella:
- zsh-better-npm-completion — cache-aware
npm installcompletion - zsh-cargo-completion — live
cargo add/cargo installcompletion - zsh-cpan-completion — live MetaCPAN
cpan/cpanmcompletion - zsh-dotnet-completion — dotnet CLI completion
- zsh-gem-completion — ruby
gem installremote completion - zsh-git-acp — 159 git aliases + add/commit/push keybindings
- zsh-git-repo-cache — index every git repo on disk
- zsh-learn — MySQL-backed learning collection / quiz
- zsh-more-completions — 33,175-file mega completion corpus
- zsh-nginx — nginx commands + service-wrapper aliases
- zsh-pip-description-completion — pip remote completion with descriptions
- zsh-sed-sub — in-place sed substitution on the command line
- zsh-sudo — ESC ESC to prepend sudo
- zsh-xcode-completions — xcodebuild / xcrun / swift completion