Now I love vim but I have seen fear in the eyes of people who somehow find themselves faced with vim for the first time. If you haven't experienced that fear then don't feel all safe and snugly because it will happen to you one day. But perhaps you don't fear it and since you were little you have always dreamt of being able to save other people from vim. In that case the following article will equip you with the necessary skills to become a vim first responder.
First and foremost the stop-drop-and-roll of the vim world - exiting without saving:
ESC
:
q
!
ENTER
So the ESC key puts you into normal mode (sometimes called command mode). Keys do different things depending on which mode you are in. In normal mode the above key combination will quit without complaining and without saving. Now hitting ESC when already in normal mode does nothing (other than perhaps beep at you) so it's safe to do it just in case you have accidentally fallen into the depths of insert mode and not realised it.
If you are feeling brave and you actually want to modify the file, you need change to insert mode by simply pressing the i key (if you are disoriented and don't know which mode you are in escape to normal mode first just to be safe):
ESC
i
Now go for it - enter the characters. But be wary of using the arrow keys in insert mode - hidden dangers may lurk there!
Alright keep low, now you are going to have to manoeuvre. First, escape to normal mode. Now I won't be all self-righteous and say you have to use the hjkl keys because using the arrow keys is usually fine in both modes (unless you find yourself in an escape room with a VT100 terminal).
ESC
h
j
k
l
But be warned: back in the old days if you tried to use the arrow keys especially in insert mode, scary escape sequences would start to dance across the terminal. If this fate befalls you, then it is time to stop-drop-and-roll. To stay safe, a good first responder will attach the hjkl keys to their Swiss army knife just in case.
Deleting characters can also get a bit hairy. Backspace can usually be used in insert mode. I repeat backspace can usually be used:
BACKSPACE
But ... it can also cause scary escape sequences to dance across the terminal. If you are lucky it may simply be ineffectual. To safely delete a single character, escape to normal mode and hit x:
ESC
x
Finally lets seal off the area by saving and quitting:
ESC
:
w
q
!
ENTER
You could use other key combinations to save and quit but I think this one is the most memorable because it is : (just because), w for write, q for quit, ! for just-do-it-already-without-bothing-me-further.
So I think that's all you probably need to know about how to be a vim first responder. If you want further training for that fateful day you encounter vim, try the Interactive Vim Tutorial.