Useful vi commands

Just in case you’re lost at some point.

“o” = insert mode
“A” = edit at the end
“a” = edit where you are
“shift r” = replace some text
“yy” “5yy” = copy the lines
“p” “shift p” = paste below or above the line
“dd” “10dd” = deletes the line
“shift h” = go top
“shift l” or “shift g” = go bottom
“cw” = replace only 1 word – different than “shift r”
“/” = search forward | “n” and “shift n” – go to the next search
“?” = search backward
“u” = undo
“:%s/the/katmai” – replace in all the doc
“:1s/the/katmai” – replace on a line
“:e filename” – loads a file
“:r filename” – loads the contents of another file