Vim Notes

visual block

<C-v> enters Visual Block (not visual line) mode

Once you’ve selected text you can I/A to insert and the beginning/end, or c (change) to delete the selected text, and change to insert mode. Once you’re done typing, hit Esc to affect each line from the visual block selection.

autobuf commands

Examples from my vim config:

" run set spell when editing markdown
autocmd VimEnter * if expand('%:e') == 'md' | set spell
" or when writing a git commit
autocmd BufRead,BufNewFile * if expand('%:t') == 'COMMIT_EDITMSG' | set spell

See here for more autocmd events.

VimLeavePre is another useful one, to run a linter/command against a file after saving


Ctrl+U/Ctrl+D scrolls up down

Scrolling relative to cursor:

Integer increment/decrement

Ctrl+A and Ctrl+X increment/decrement integers, very useful for automating things with macros.


Other than the typical Ctrl+O, Ctrl+I to jump forward/back in your tag stack, can also use * and # to jump forward/backward against the word currently under the cursor, which is useful for variable names/constants