The trick to using vim is knowing whether you are in COMMAND mode (moving around on top of the text) or INSERT mode (inserting text into the file). Usually it says -- INSERT -- at the bottom of the screen when in insert mode. If you are ever unsure, hit the ESCAPE key to get into COMMAND mode.
h, j, k, l move left, down, right, up (or use the arrow keys) Cntrl-f forward one screen Cntrl-b backward one screen G move to end of file gg move to beginning of file #G move to line # (eg, 207G moves to line 207) 0 move to beginning of line $ move to end of line H move to top of screen (High) M move to middle of screen L move to bottom of screen (Low) /pattern search forward for pattern (hit n to repeat search for next) w move forward one word at a time b move backward one word at a time
NOTE: you should be in COMMAND mode to execute these commands. Some of them, like i, a, A, and R, put you into INSERT mode.
i insert text a append text (after cursor) A append text at end of line x delete character dd delete line #dd delete # lines (eg, 5dd deletes 5 lines) yy copy line p paste line (below cursor) r replace one character R replace until you hit ESCAPE u undo (can do multiple times if needed) Cntrl-r redo
:wq write (save) and quit :q! quit without saving