- Normal: the mode that you are generally in at the beginning of a session. One does most of their moving around in this mode.
- Insert: the mode where you are inserting text.
- Visual: the mode for selecting text.
- Command: the mode where you use commands for reading/writing files and managing your session.
I imagine I am missing some, but these are the ones I use the most.
-
i - go into insert mode before the cursor (mnemonic: I-nsert)
-
a - go into insert mode after the cursor (mnemonic: A-ppend)
Capital letters are like their lowercase counterparts, but MORE!
-
I - go into insert mode and move to the beginning of the line-
-
A - go into insert mode and move to the end of the line
Or sometimes the opposite of the lowercase.
- o - go into insert mode and move into a newline underneath the current line
- O - go into insert mode and move into a newline above the current line
These next four are movements
-
t{char} - move the cursor right to the character in front of the next instance of the given character (mnemonic: T-o)
-
T{char} - move the cursor left to the character behind the next instance of the given character
-
f{char} - move the cursor right to the next instance of the given character (mnemonic: F-ro)
-
F{char} - move the cursor left to the last instance of the given character
-
c{movement} - deletes the object (letter, word, line, paragraph) traversed in the given movement, and goes into insert mode {mnemonic: C-ut}
-
C - deletes the rest of the line and goes into insert mode
-
cc - deletes the entire line and goes into insert mode
-
r - goes into replace mode for the character under the cursor (use case: fix a one letter typo)
-
R - goes into replace mode until ESC is hit.
-
s - deletes the character under the cursor and goes into insert mode (mnemonic: S-ubstitute)
-
S - deletes the entire line and goes into insert mode
-
d{movement} - deletes the object traversed in the given movement
-
D - deletes the rest of the line
-
dd - deletes the current line
Note: Deletion puts things into a register.
-
p - takes the last object to be put into a register and puts it after the cursor (mnemonic: P-aste)
-
P - takes the last object to be put into a register and puts it before the cursor
-
y{movement} - the characters traversed in the given movement
-
v - go into visual mode (to select text)
- w - save the current file, if it already has a name (mnemonic: W-rite)
- w {name} - save the current file with the given name
- q - close the current tab or window
- qa - close all windows
'a' is actually a modifier for a lot of things, so as you work, try adding an a to things like the 'w' command
Hint: it SAVES ALL THE THINGS!