vi or vim Cheat Sheet
Basic Cursor Movement:
h Move left
j Move down
k Move up
l Move right
H Move to top of screen
L Move to bottom of screen
0 Move to the beginning of the line
$ Move to the end of the line
Search for strings:
/string Search forward for string
?string Search back for string
n Search for next instance of string
N Search for previous instance of string
i Insert before cursor
a Append after cursor
r Replace one character
x Delete character to the right of cursor
X Delete character to the left of cursor
D Delete to the end of the line
dd Delete current line
:d Delete current line
:wq Save and Exit.
ZZ Save and Exit Shortcut.
:q Exit only, there’s no changes to the file.
:q! Exit and ignore any changes.