vim – indent after curly brace, set tab to 4 spaces

Shortcuts: Ctrl q to exit vim

I really like this tip to exit vim quickly.

You can use ZZ to save and exit vim but it’s 3 keystrokes. This neat hack lets you do the same in just 2 keystrokes. On the Mac:



vim tips

Indent multiple lines quickly

Use >


e.g. to indent 5 lines use:




To mark a block of 3 lines and indent in vim, use:



Repeat last change

Use .

e.g. if deleting a word with dw then just hit .to repeat.


Split screen and view another file

:vsplit <file>