@liunuozhi/pi-vi

Minimal vi-style modal editing for Pi's TUI prompt

Package details

extension

Install @liunuozhi/pi-vi from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@liunuozhi/pi-vi
Package
@liunuozhi/pi-vi
Version
0.1.0
Published
May 2, 2026
Downloads
not available
Author
liunuozhi
License
MIT
Types
extension
Size
19.4 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-vi

Minimal vi-style modal editing for Pi's input prompt. Trimmed to the muscle-memory core.

install

pi install npm:@liunuozhi/pi-vi

Restart Pi after install.

commands

Small key set. No counts, no ;/,, no text objects, no EX mode, no clipboard sharing.

mode

key action
Esc Insert → Normal
i Insert at cursor
I Insert before first non-blank
a Insert after cursor
A Append at line end
o Open line below + Insert
O Open line above + Insert

motion (Normal)

key action
h j k l left / down / up / right
0 / $ line start / line end
w / b next word / previous word
gg / G top / bottom of buffer
f{c} / F{c} jump to c (forward / backward, inclusive)
t{c} / T{c} jump up to c (forward / backward, exclusive)

edit (Normal)

key action
x delete char under cursor
dd delete line
dw delete word forward
df{c} / dt{c} delete to c (inclusive / exclusive)
D delete to end of line
cc change line (delete + Insert)
cw change word (delete + Insert)
cf{c} / ct{c} change to c
C change to end of line

copy / paste

key action
yy yank line into internal register
p paste internal register after cursor

undo

key action
u undo

architecture

  • index.tsModalEditor extends CustomEditor; all key handling.
  • motions.ts — pure findWordMotionTarget and findCharMotionTarget.

Run checks:

npm install
npm run typecheck

credits

Inspired by lajarre/pi-vim, which covers the high-frequency 90% of vim. pi-vi trims that further to the muscle-memory core.