@onenote/pi-vim-editor

Vim-style modal editor extension for pi

Package details

extension

Install @onenote/pi-vim-editor from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@onenote/pi-vim-editor
Package
@onenote/pi-vim-editor
Version
0.1.1
Published
Apr 17, 2026
Downloads
77/mo · 9/wk
Author
onenote
License
Apache-2.0
Types
extension
Size
59.7 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-vim-editor

A Vim-style modal editor extension for pi.

Repository: https://github.com/OneNoted/pi-vim-editor

Features

Current feature set:

  • normal / insert / visual / visual-line modes
  • counts
  • motions: h, j, k, l, w, b, e, ge, 0, ^, $, gg, G
  • find motions: f, F, t, T, ;, ,
  • operators: d, c, y
  • common commands: x, X, s, S, D, C, Y, p, P, u
  • text objects: iw, aw
  • visual selection rendering
  • mode label in the editor border

Install

Try without installing

pi -e /path/to/pi-vim-editor

Install from a local path

pi install /path/to/pi-vim-editor

Install from npm

pi install npm:@onenote/pi-vim-editor

Development

Typecheck and run the local crash/smoke suite with Bun:

bun install
bun run typecheck
./scripts/smoke.sh

To preview the published tarball contents:

bun run pack:dry-run

Publish

bunx npm login
bunx npm publish --access public

bun run pack:dry-run is the easiest local packaging check before publishing.

Safety / failure mode

This extension currently relies on pi editor internals to implement modal rendering and behavior.

To reduce host breakage while iterating, it includes a failsafe mode:

  • if modal handling throws, it logs once
  • it falls back to the built-in editor behavior for the rest of the session
  • the mode label shows SAFE

Current limitations

This is already usable, but it is still aiming for tighter Vim parity in areas like:

  • exact text object semantics
  • some edge cases around wrapped lines and empty lines
  • perfect paste behavior in all linewise/charwise combinations
  • long-term compatibility with future pi internal editor changes

Packaging notes

This package follows pi package conventions via the pi key in package.json and is tagged with the pi-package keyword for discoverability.