Edit the downstream side of a shell pipeline and see its output update live, without re-running the upstream side.
zsh-halfpipe lets you iterate on filters, regexes, and other pipeline stages in place by pressing Ctrl-G.
git log --oneline | grep -E "fix"Hit Ctrl-G. Now refine the regex — change it to "fix|feat", then "^[a-f0-9]+ (fix|feat):" — and see what matches instantly. The left side runs once; you iterate on the right without re-running git log.
Great for getting a regular expression right without executing the full pipeline on every attempt.
- The upstream command is cached on activation and shown in cyan.
- Press
Ctrl-X Ctrl-Gto re-run the upstream and refresh the cache. - Press
Ctrl-Gagain to exit. PressEnterto run the final command normally. - Preview mode only live-executes explicitly allowlisted, stream-oriented commands. By default that list is
awk,sed,grep,head,tail,tr,cut,sort,uniq,wc,cat,nl,column, andjq.
- Preview commands run in a
zsh -fcsubprocess hydrated with your current aliases and functions. Ctrl-Gis borrowed while a pipeline is on the command line and restored when you exit.Ctrl-X Ctrl-Gis bound while preview mode is active and released on exit.- Output is cached when you first activate preview. Use
Ctrl-X Ctrl-Gto refresh it. - Commands outside that allowlist are not executed in preview mode, even without globs. This avoids live-running
perl, ad-hoc scripts, or destructive commands likerm. - If you want to allow additional preview commands, set
HALFPIPE_PREVIEW_COMMAND_ALLOWLISTbefore sourcing the plugin.
typeset -ga HALFPIPE_PREVIEW_COMMAND_ALLOWLIST=(awk sed grep head tail tr cut sort uniq wc cat nl column jq)
source ~/.local/share/zsh-halfpipe/halfpipe.zshThis works whether you're using plain Zsh, Oh My Zsh, or any other setup.
mkdir -p ~/.local/share
git clone https://github.com/raimo/zsh-halfpipe.git ~/.local/share/zsh-halfpipeThen add this line to your ~/.zshrc:
source ~/.local/share/zsh-halfpipe/halfpipe.zshgit clone https://github.com/raimo/zsh-halfpipe.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-halfpipeThen add zsh-halfpipe to your plugins array in ~/.zshrc:
plugins=(git zsh-halfpipe …)zinit light raimo/zsh-halfpipeantigen bundle raimo/zsh-halfpipeThe repo keeps the implementation in halfpipe.zsh and exposes a root-level
zsh-halfpipe.plugin.zsh entrypoint for Oh My Zsh and other plugin managers
that auto-detect *.plugin.zsh files.
Just remove the source line (or the plugin name from the plugins= array) and delete the cloned directory.
Syntax-check the script with:
zsh -n halfpipe.zshRun the plugin test suite with:
zsh tests/run.zshMutation-check the test harness with:
zsh tests/test-the-test.zshThe repo intentionally keeps the implementation in a single file so it can be sourced directly by shell plugin managers.
This software is provided as-is, without warranty of any kind, and you use it at your own risk. By using it, you accept full responsibility for reviewing what it does in your environment; the author disclaims liability for any loss, damage, or disruption resulting from its use. See LICENSE for the full license terms.
Core logic for this tool was created by a human and has been used daily in real workflows. AI was used to improve test coverage, help with documentation, and fix corner cases revealed by the test harness; it was not the origin of the core interaction design or primary implementation logic.
