Notes on Vim

I use vim as my occasional text editor, especially when I am working on small projects or just editing a text document. Here’s some notes for myself, mostly created by searching the web and pointing to or copying other people’s answers.

Modes

Files

Opening commands

Cursor movement

Line search

f<c> to go the next occurence of c, ; to repeat this search, , to repeat the search in backward direction F<c> to go the previous occurence of c, ; to repeat this search, , to repeat the search in forward direction

Replacing a word in a block

Changing a word at n positions

Recording and playing macros

Swap two characters

Switch case

Replace character

Move block of text

Delete

Search

Folds

Movements

zo Open current fold under the cursor.
zc Close current fold under the cursor.
za Toggle current fold under the cursor.
zd Delete fold under the cursor. (only the fold, text is unchanged.)
zj Move the cursor to the next fold.
zk Move the cursor to the previous fold.
zR Open all folds in a current buffer. (Reduce all folds)
zM Close all open folds in a current buffer. (Close more and More folds)
zE Delete all folds the current buffer
:fold In Visual mode: fold selected lines

Powerless verbs

Miscellaneous movements/Scrolling

More scrolling tips and techniques:

External Resources