| Cursor movement | |
| Forward one space | l,space or right arrow |
| backward one space | h,backspace or left arrow | next line (beginning) | + or RETURN |
| next line (same column) | j, ^N or down arrow |
| previous line | k,^P,up arrow |
| beginning of line | ^ |
| end of line | $ |
| goto line | linenumber G (example: 45G) |
| next word | w,W (not identical commands) |
| previous word | b,B (not identical commands) |
| end of word | e,E (not identical commands) |
| beginning of sentence | ( |
| end of sentence | ) |
| matching parenthesis, bracket or brace | % |
| home | H |
| midscreen | M |
| lower screen | L |
| Screen Commands | |
| scroll | ^U,^D |
| page | ^F,^B |
| redraw | ^L,^R |
| insert before cursor | i |
| append after cursor | a |
| open new line and insert | o (below), O (above |
| Deletion | |
| delete character | x |
| delete word | dw |
| delete line | dd |
| Modification | |
| undo last change | u |
| repeat last insert or delete command | . |
| overstrike new character | r new-character |
| overstrike | R new characters ESC |
| copy text into unnamed buffer | yy |
| put text from unnamed buffer | p |
| copy text into named buffer examples | "ayy - yank one line into buffer a 5"byy - yank 5 lines into buffer b |
| put text from named buffer | "ap |
| join lines | J |
| Searching | |
| search forward | /pattern/ |
| search backward | ?pattern? |
| repeat last search | n (same direction), N (opposite direction) |
| I/O | |
| write changes back to file | :w |
| read in a file | :r filename |
| quit | :q |
| quit without changing file | :q! |
| Command count examples | |
| move 3 words forward | 3w |
| move 4 pages forward | 4^F |
| delete 6 lines | 6dd |
| Search and replace examples | |
| replace all occurrences of the string 'cat' by 'feline' |
:g/cat/s//feline/g |
| replace any occurrence of 'cat' at the beginning of a line |
:g/^cat/s//feline/g |
| put a space at the beginning of every line |
:g/^/s// /g |
| replace each lower-case letter by the same letter doubled |
:g/[a-z]/s//&&/g |
| Editing several files | |
| edit next file | :n |
| rewind to first file in list | :rew |
| edit a file out of order | :e filename |
| find out where you are | ^g |