home / samples / VimMotion Extension

VimMotion Extension

Adds vim-style motion commands with count support to Buffee.

BuffeeVimMotion(new Buffee(el, { h: 15 }))

Basic:
Word:
WORD:
Line:
Go to:
Ln , Col |

Supported Motions

MotionDescriptionExample
h, lLeft / Right5h = 5 chars left
j, kDown / Up10j = 10 lines down
w, bNext / Previous word start3w = 3 words forward
eEnd of word2e = end of 2nd word
W, B, EWORD motions (whitespace-delimited)W = next WORD
0Start of line
$End of line
^First non-blank character
ggGo to line (default: first)5gg = line 5
GGo to line (default: last)10G = line 10
+, -Next/prev line, first non-blank3+ = 3 lines down, first non-blank

Usage

const editor = BuffeeVimMotion(new Buffee(el, { h: 15 }));

// Execute motions programmatically
editor.VimMotion.move('5j');   // down 5 lines
editor.VimMotion.move('w');    // next word
editor.VimMotion.move('10G');  // go to line 10
editor.VimMotion.move('$');    // end of line