Underutilized (by me) (n)vim bindings / commands:
doing non-insert things while remaining in insert mode:
Ctrl-[: leave insert mode, same as Esc (and often easier to reach)Ctrl-o: one normal command, then back to insert.Ctrl-w: delete previous word.Ctrl-u: delete back to start of line.Ctrl-h: backspace, often easier than reaching for Backspace.Ctrl-t: increase indentCtrl-d: decrease indentCtrl-r 0: insert last yanked textS-Right/S-Left: move right/left one word (could go in section below but I generally
horizontal motions
gm: jump to middle of screengM: jump to middle of current line's text25gM: jump to the 25% mark of current line's text
;and,: repeat the lastf/F/t/Tsearch, forward or backward respectively- and for treesitter, these are conveniently bound to jump to repeat the last treesitter motion
misc normal mode
R: replace multiple characters (typing on top of while replacing extant text)H/M/L: move cursor to top, middle, or bottom of windowU: undo any changes in the current linez<CR>orzt: redraw, current line at top of windowz.orzz: redraw, current line at center of windowz-orzb: redraw, current line at bottom of windowCtrl-YandCtrl-Eare handy, moving the view up/down a line without moving the cursor.- And strange but cool... in insert mode they copy the character from the above/below line. Great for csv style editing.
cifor change inner (cafor change around)...ci"to change content inside a pair of quotation marks- and the same for any pair
ci(orci)to change content inside parens (and likewise for any other pair
- and the same for any pair
cawchanges a wordcaschange a sentencecapchange a paragraph
q:command history windowq/search history window (andq?for backward-search history) -number Gmoves to that line number (I've always used:number<Enter>)
some direct quotes from the manual on reading and writing files (and system commands)
To save part of the file, type
v{normal} motion:w FILENAME{vim}. **
To retrieve the contents of a file, type
:r FILENAME{vim}.
NOTE: You can also read the output of an external command. For example,
:r !ls{vim} reads the output of thelscommand and puts it below the cursor.