Skip to content

Latest commit

 

History

History
140 lines (100 loc) · 2.71 KB

File metadata and controls

140 lines (100 loc) · 2.71 KB

pi-vim

npm node

Vim mode for pi.

Normal, insert, visual, and replace modes with motions, text objects, yank/put, and undo/redo.

Demo

pi-vim demo

Install

pi install npm:@leohenon/pi-vim

Usage

Toggle with:

/vim-mode

Insert mode

  • Esc / Ctrl-[ → normal mode
  • Shift+Alt+A → line end
  • Shift+Alt+I → line start
  • Alt+o → open line below
  • Alt+Shift+O → open line above

Normal mode

Mode

  • i, a, I, A
  • o, O
  • v → visual
  • V → visual line
  • R → replace

Motions

  • h, j, k, l
  • w, b, e
  • W, B, E
  • 0, ^, _, $
  • gg, G
  • f, F, t, T
  • ;, ,
  • counts on motions

Delete

  • dd, dw, de, db, dW, dE, dB
  • d0, d^, d$, d_, dG
  • d{count}j, d{count}k
  • df, dF, dt, dT
  • diw, daw, di", da", di', da', di` , da` , di(, da(, di[, da[, di{, da{

Change

  • cc, cw, ce, cb, cW, cE, cB
  • c0, c^, c$, c_
  • cf, cF, ct, cT
  • ciw, caw, ci", ca", ci', ca', ci` , ca` , ci(, ca(, ci[, ca[, ci{, ca{

Yank

  • yy, Y
  • yw, ye, yb, yW, yE, yB
  • y0, y^, y$, y_, yG
  • y{count}j, y{count}k
  • yf
  • yiw, yaw, yi", ya", yi', ya', yi` , ya` , yi(, ya(, yi[, ya[, yi{, ya{

Edit

  • x, s, S
  • r{char}
  • R → replace mode
  • ~ → toggle case
  • D, C
  • counts on x, r, ~

Put

  • p, P
  • counts on p, P
  • puts read from the system clipboard

Undo

  • u, Ctrl-_
  • Ctrl-r
  • counts on undo/redo

Visual mode

Characterwise

  • v enters visual mode
  • Esc exits to normal mode
  • d / x delete selection
  • y yank selection
  • editor copy shortcut yanks selection
  • c change selection
  • p, P replace selection with system clipboard

Linewise

  • V enters visual line mode
  • j, k extend by full lines
  • Esc exits to normal mode
  • d / x delete selected lines
  • y yank selected lines
  • c change selected lines
  • p, P replace selected lines from the system clipboard

Note

yanks sync the system clipboard, puts read from it, and delete/change operations do not overwrite it

Files

pi-vim/
  index.ts
  package.json
  README.md

Note

If you run into any bugs, please open an issue.

License

MIT