pi-vim-motions
Vim-style motion extension for Pi.
Package details
Install pi-vim-motions from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-vim-motions- Package
pi-vim-motions- Version
1.0.0- Published
- Apr 30, 2026
- Downloads
- not available
- Author
- fsvensson
- License
- MIT
- Types
- extension
- Size
- 58.2 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Pi Vim Motions Extension
Vim Motions extension and keybindings for pi
How to install
pi install git:github.com/fredriksvensson/pi-vim-motions- add into ~/.pi/keybindings.json:
{
"tui.editor.cursorLeft": [
"left",
"ctrl+h"
],
"tui.editor.cursorDown": [
"down",
"ctrl+j"
],
"tui.editor.cursorUp": [
"up",
"ctrl+k"
],
"tui.editor.cursorRight": [
"right",
"ctrl+l"
],
"tui.select.down": [
"down",
"ctrl+n",
"ctrl+j"
],
"tui.select.up": [
"up",
"ctrl+p",
"ctrl+k"
],
"tui.editor.deleteToLineEnd": [
"alt+k"
],
"app.model.cycleForward": [
"alt+p"
],
"app.model.cycleBackward": [
"shift+alt+p"
]
}
app.model.cycleForward, app.model.cycleBackward and
tui.editor.deleteToLineEnd conflict with what is usually used by neovim for
example as navigating selectors.
Usage
- Default mode: INSERT
escapein INSERT → NORMALescapein NORMAL keeps base escape/cancel behavioriin NORMAL → INSERTain NORMAL → move right one char, then INSERTuin NORMAL → undo (supports counts, e.g.2u)- Unmapped printable keys in NORMAL are ignored (no text inserted)
Implemented commands (current)
Motions
h/j/k/l: left/down/up/rightw/b/e: word motionsW/B/E: same as lowercase in current implementation0/^: line start$: line endf<char>: find next matching char on lineF<char>: find previous matching char on linegg: first lineG: last line- Counts in normal mode (
3w,5l, etc.)
Delete
x: delete char under cursor (stores deleted char in register)denters pending operator state- Supported completions:
dd(delete current line, stores linewise)dh/dldw/db/de/dW/dB/dEd0/d^/d$df<char>/dF<char>
D: delete to end of line- If second key is unsupported, delete is canceled with no text change
escapecancels pending delete- Counts supported (
2x,2dd,d2w) - Mode stays NORMAL after delete commands
Change / Substitute
C: change to end of line (delete to EOL and enter INSERT)S: substitute current line (clear line and enter INSERT)
Yank / Paste
yenters pending operator state- Supported completions:
yy(yank current line, linewise)yw/yb/ye/yW/yB/yEy0/y^/y$yf<char>/yF<char>
Y: yank to end of linep: paste after cursor (or below for linewise register)P: paste before cursor (or above for linewise register)- If second key is unsupported, yank is canceled with no text change
escapecancels pending yank- Counts supported (
y3wetc.)
Regression expectations
- INSERT mode keeps normal typing behavior
entersubmitsshift+enterinserts newline- Control/system shortcuts (like
ctrl+c,ctrl+d) continue to work
Out of scope (v1)
In order of when its likely to be implemented:
- Visual mode
- redo: not implemented in pi itself
- Text objects (
diw,ci(, etc.) - Repeat (
.), macros, named registers - Search motions/repeats (
/,?,n,N,;,,) - Full WORD/edge-accurate Vim parity
;/,repeat-find
Development
This is its own package with its own tooling so that its not depending on pi's
environment for development. Just run pnpm install to pull necessary
dependencies and pnpm test to run the test suite.
I added some basic agent related things and fallow. You can of course make a pull request if you have something you want to extend but please don't just let the coding agent go ham on it.
Otherwise raise an issue and I can have a look at it.
Next step in this is probably to tidy up the commands.ts and introduce a bit more extendable structure to it. I will see how I can extend pi. For now its more so I can edit text properly inside pi.