Useful Vim Commands
The following is a list of useful vim commands. I've separated the commands
based on whether they're useful in general, specifically for
literature-writing purposes, or specifically for code-writing purposes.
General Purpose
zz
Centers the current line on the middle of the screen. Useful when you don't want to constantly be looking at the top/bottom of your screen when you're editing.
CTRL + u/d
Moves the cursor up and down half a page respectively. A much faster way of traversing through the document than the usual j/k.
[]%
Puts your cursor at the location []% into the document. E.g. 50% will move your cursor halfway through the document. Especially useful when you have a rough idea of where in the document you need to be, but don't remember any of the information present there to do a normal / search.
Writing Literature
gj/gk
Moves the cursor down/up respectively through a multi-line text block. This situation is encountered more often when writing larger paragraphs that wrap across multiple lines, which is not so common (often discouraged) when writing code.
A
Jumps to the end of the current line and enters insert mode after the final character. I find that this is used much more often when doing traditional writing compared to when writing code.
Writing Code
:tabe [filepath]
Pretty much mandatory if you're working on any project with more than one codefile. Opens the file in a new tab. You can navigate between tabs using :tabn for next and :tabp for previous.
>
Indents the line one level. Can add a number before the command to indent that many levels instead, e.g. 3> will indent 3 levels. Removing indents can likewise be done with the < command.