character positioning --------------------- k or ^p move the cursor up one character j or ^j or ^n move the cursor down one character h or ^h or move the cursor left one character l or move the cursor right one character word positioning ---------------- w move the cursor to the beginning of the next word W move the cursor to the beginning of the next word, skipping punctuation b move the cursor to the beginning of the previous word B move the cursor to the beginning of the previous word, skipping punctuation e move the cusor to the end of the next word E move the cusor to the end of the next word, skipping punctuation line positioning ---------------- 0 move the cusor to the first column in the current line | move the cusor to column in the current line ^ move the cusor to the first non-white position in the current line $ move the cusor to the last non-white position in the current line + or move the cusor to the first non-white position in the next line - move the cusor to the first non-white position in the previous line G move the cursor to the last line in the file G move the cursor to line in the file sentence positioning -------------------- ( move the cursor to the beginning of the previous sentence ) move the cursor to the end of the next sentence paragraph positioning --------------------- { move the cursor to the beginning of the previous paragraph } move the cursor to the end of the next paragraph section positioning ------------------- [[ move the cursor to the beginning of the previous section ]] move the cursor to the end of the next section a section marker is a line with a { in the first column cursor placement in the screen ------------------------------ H move the cursor to the top line of the screen H move the cursor to the 'th line from the top of the screen M move the cursor to the middle line of the screen L move the cursor to the bottom line of the screen L move the cursor to the 'th line from the bottom of the screen adjusting the screen -------------------- ^y move the screen up one line ^e move the screen down one line ^u move the screen up 1/2 page ^d move the screen down 1/2 page ^b move the screen up one page ^f move the screen down one page ^l redraw the screen z make the current line the top line in the screen z make line the top line in the screen z. make the current line the middle line in the screen z. make line the middle line in the screen z- make the current line the bottom line in the screen z- make line the bottom line in the screen marks ----- m mark the current position with name ` move the cursor to the position with name ' move the cursor to the first non-white character of the line containing the mark with name `` move the cursor back to where you were before the last / ? or G command '' move the cursor to the first non-white character of the line where you were before the last / ? or G command searching --------- % move the cursor to the balancing ( or ) or [ or ] or { or } f move the cursor forward in the current line to F move the cursor backward in the current line to t move the cursor forward in the current line to, but not including, T move the cursor backward in the current line to, but not including, / move the cursor forward to ? move the cursor backward to :se ic ignore case when searching :se noic pay attention to case when searching :se magic turn on regular expressions in :se nomagic turn off regular expressions in special characters in when regular expressions are off: ^ matches beginning of line $ matches end of line special characters in when regular expressions are on: ^ at beginning of pattern, matches beginning of line $ at end of pattern, matches end of line . matches any character \< matches the beginning of a word \> matches the end of a word [] matches any single character in [^] matches any single character not in [-] matches any character between and * matches any number of the preceeding pattern inserting text -------------- a insert after the current cursor position A insert after the end of the current line i insert before the current cursor position I insert before the beginning of the current line o insert a new line of after the current line O insert a new line of before the current line deleting text ------------- ^h or while entering text, delete the previous character ^w while entering text, delete the previous word x delete the next character into the unnamed buffer x delete the next characters into the unnamed buffer X delete the previous character into the unnamed buffer X delete the previous characters into the unnamed buffer dw delete the next word into the unnamed buffer db delete the previous word into the unnamed buffer dd delete the current line into the unnamed buffer dd delete the next lines into the unnamed buffer D delete the rest of the current line into the unnamed buffer d delete the text from the current cursor position to the new cursor position into the unnamed buffer " delete the text into the named buffer copying text ------------ yy or Y yank a copy of the current line into the unnamed buffer Y yank a copy of the next lines into the unnamed buffer y yank a copy of the text from the current cursor position to the new cursor position into the unnamed buffer " yank a copy of the text into named buffer placing text ------------ p place a copy of the text in the unnamed buffer after the cursor P place a copy of the text in the unnamed buffer before the cursor "p place a copy of the text in named buffer after the cursor "P place a copy of the text in named buffer before the cursor "p place a copy of the 'th most recently deleted text after the cursor "P place a copy of the 'th most recently deleted text before the cursor changing text ------------- r replace the next character with R replace the next characters with s substitute for the next character cw change the next word to cc change the current line to C change the rest of the current line to c change the text from the current cursor position to the new cursor position to joining text ------------ J join the next line to the end of the current line J join the next lines together indenting text -------------- ^d while entering text, back up over the supplied indentation 0^d while entering text, delete all supplied indentation ^i or while entering text, insert one shift width :se ai turn on auto-indentation :se noai turn off auto-indentation :se sw= set the shift width to characters << shift one line left by one shift width << shift lines left by one shift width >> shift one line right by one shift width >> shift lines right by one shift width < or > can be used with almost any of the cursor positioning commands to shift multiple lines left or right files ----- ZZ or :wq or :x write out the current file and quit :w write out the current file and continue :w write out the current file to :q quit :q! quit without writing out any changes :e edit :e! edit , discarding any changes made to the current file :e! start over editing the current file, discarding any changes made to the current file :e + edit , starting at the end :e + edit , starting at line :r read into the current file after the current line :n edit the next file in the argument list :n! edit the next file in the argument list, discarding any changes made to the current file :n specify a new argument list misc ---- u undo the last command U restore the current line to its previous state n repeat the last multi-character search command N like n but in the opposite direction ; repeat the last single-character search command , like ; but in the opposite direction . repeat the last command which changed the file ^g display a status line ^v while entering text, insert in the text without interpreting it