pi-reverse-search
v0.1.1
Published
Ctrl+R reverse prompt search for Pi's TUI editor, inspired by shell reverse-i-search.
Maintainers
Readme
pi-reverse-search
Ctrl+R reverse prompt search for Pi's TUI editor, inspired by shell reverse-i-search in bash/readline and zsh.
Features
- Press
Ctrl+Rin Pi's input box to enter reverse prompt search. - Type to filter previous user prompts from the current session branch.
- Matching text is highlighted in the selected prompt.
- Press
Ctrl+Ragain to cycle older matches for the current query. - Press
Ctrl+S,Down, orCtrl+Nto cycle newer matches. - Press
Enterto accept and submit the selected prompt. - Press
EscorCtrl+Gto cancel and restore your draft. - Press
Ctrl+Cto cancel search and let Pi handle normal clear/interrupt behavior.
Install
From a local checkout
pi install /absolute/path/to/pi-reverse-searchOr test without installing:
pi -e /absolute/path/to/pi-reverse-search/extensions/reverse-search.tsFrom GitHub
pi install git:github.com/viggy28/[email protected]Or install the latest main branch:
pi install git:github.com/viggy28/pi-reverse-searchFrom npm
pi install npm:pi-reverse-searchTo pin a specific release:
pi install npm:[email protected]Usage
- Start Pi after installing the package, or run
/reloadin an existing session. - Press
Ctrl+Rin the prompt editor. - Type a search query.
- Use
Ctrl+R/Ctrl+Sto cycle matches. - Press
Enterto submit, orEsc/Ctrl+Gto cancel.
Development
Run tests:
npm testSmoke-test extension loading:
npm run smokePackage layout
extensions/reverse-search.ts # Pi extension entrypoint
extensions/reverse-search-lib/core.ts # Pure search state + key decoding logic
test/reverse-search.test.mjs # Node tests for core behaviorTroubleshooting
Extension shortcut conflict for ctrl+r
This package does not register a global Pi shortcut; it handles Ctrl+R only inside its custom prompt editor. If Pi reports a conflict such as:
Extension shortcut conflict: 'ctrl+r' is built-in shortcut for app.session.rename and /path/to/pi-reverse-search/src/index.tsthen Pi is loading an older local checkout that registered Ctrl+R as a global shortcut. Remove that local install, then reload Pi and install the npm package instead:
pi uninstall /path/to/pi-reverse-search
pi install npm:pi-reverse-searchIf the warning path points at an npm cache/package directory rather than a local src/index.ts, update to the latest package:
pi install npm:pi-reverse-search@latestNotes
This extension searches prompts in the active Pi session branch. It does not search all historical session files.
