home / samples / VimMotion Extension
Adds vim-style motion commands with count support to Buffee.
BuffeeVimMotion(new Buffee(el, { h: 15 }))
| Motion | Description | Example |
|---|---|---|
h, l | Left / Right | 5h = 5 chars left |
j, k | Down / Up | 10j = 10 lines down |
w, b | Next / Previous word start | 3w = 3 words forward |
e | End of word | 2e = end of 2nd word |
W, B, E | WORD motions (whitespace-delimited) | W = next WORD |
0 | Start of line | |
$ | End of line | |
^ | First non-blank character | |
gg | Go to line (default: first) | 5gg = line 5 |
G | Go to line (default: last) | 10G = line 10 |
+, - | Next/prev line, first non-blank | 3+ = 3 lines down, first non-blank |
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