// ZSH-EXPAND — THE WORLD'S MOST POWERFUL ZSH EXPANSION PLUGIN // 11,683 TESTS

zsh plugin · spacebar-triggered expansion · aliases · global aliases · suffix aliases · globs · 290+ misspelling corrections · 62 prefix commands parsed with full flag awareness · pure zsh · sub-millisecond

GitHub Issues
// Color scheme

>_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.

11,683
@test blocks (zunit)
62
prefix commands parsed
290+
built-in spell corrections
~36 µs
per regular alias expand
0
external commands in hot path

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 expansionregular aliases in command position and after sudo/env/builtin/command/exec/eval/noglob/nocorrect/nice/nohup/rlwrap/time — with full flag support
Global aliasglobal aliases expanded anywhere on the command line
Spelling correction290+ built-in corrections, user-extensible via associative array
Native expansionglobs, $params, $(cmd), =(...), !history
Tabstop snippetsaliases with $ZPWR_TABSTOP placeholders — cursor jumps to placeholder
Self-ref escapealias git="hub" expands to \hub — no infinite recursion
Correct-then-expandtypo correction chains into alias expansion in one keypress
Quote-aware expansionoptional expansion inside "double" / 'single' quoted args
Suffix aliasfile.txt<space>vim file.txt via alias -s
Autopair integrationdelegates space insertion to zsh-autopair when present
History injectionoptionally writes the fully-expanded form into history
Debug widgetCtrl+\ shows parser state without modifying the line
Expansion previewghost text shows pending expansion before space is pressed
Expansion statszpwrExpandStats 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

SpaceSupernatural expand + insert space
Ctrl+SpaceInsert literal space (bypass)
Ctrl+Opt+EDebug 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: