Command Mode Deletions d starts the delete operation. dw will delete a word. d0 will delete to the beginning of a line. d$ will delete to the end of a line. dgg will delete to the beginning of the file. dG will delete to the end of the file. u will undo the last operation. Ctrl-r will redo the last undo. Moving h moves the cursor one character to the left. j moves the cursor down one line. k moves the cursor up one line. l moves the cursor one character to the right. 0 moves the cursor to the beginning of the line. $ moves the cursor to the end of the line. w move forward one word. b move backward one word. G move to the end of the file. gg move to the beginning of the file. `. move to the last edit. Searching /text search for text in the document, going forward. n move the cursor to the next instance of the text from the last search. This will wrap to the beginning of the document. N move the cursor to the previous instance of the text from the last search. ?text search for text in the document, going backwards. :%s/text/replacement text/g search through the entire document for text and replace it with replacement text. :%s/text/replacement text/gc search through the entire document and confirm before replacing text. Copy / Paste v highlight one character at a time. V highlight one line at a time. Ctrl-v highlight by columns. p paste text after the current line. P paste text on the current line. y yank text into the copy buffer. Save and Quitting If you're in insert mode, hit Escape. Then enter : and you'll see a line at the bottom of the screen with a cursor ready to take input. To write the file you're editing, enter w. (So, you'll have :w.) That will write the file to the existing filename. If you don't have a filename or want to write out to a different filename, use :w filename. To quit Vim after you've finished, hit :q. Since Vim is your friend, it won't just pop out on you if you haven't saved your file. It will say "no write since last change," and suggest that you add ! to override. If you really want to quit, go ahead and use :q! to leave without being nagged.You can also exit Vim using ZZ, which will save and quit the file. Insert Mode last-line mode