vi filename or filename list
vim filename or filename list
Most alphabetic characters are understood as commands. To enter text you must switch to insert mode. All of the following commands switch to insert mode (except "r").
In all cases you press ESC to stop the insert mode and switch back to command mode. ESC may also be ctrl-[
| i - begin insert in front of current character | I - begin insertion at beginning of line | a - begin insert (append) after current character | A - begin inserting (appending) at end of line |
| o - open line after current line and begin insert into blank line | O - open line before current line and begin insert into blank line | R - begin replacement mode | r - replace the current character (no ESC is used here) |
| s - substitute (delete the current character and begin insert) | cw - change current word (delete it and begin insert) | C - change to end of line (delete to end of line and begin insert) | cc - change current line (delete line and begin insert) |
Remember to press ESC to stop insertion mode.
| h-left one character | j-down on line | k-up one line | l-right one character |
| b - backward one word (to left) | fc - find character c in current line | e - forward to end of word | w - forward one word (to right) |
| ^b - backward one screen (up) | ^f - forward one screen (down) | ^u - up one-half screen | ^d - down one-half screen |
| 0 - (zero) to beginning of line | $ - to end of line | G - go to bottom of file |
nG - go to line n |
| /string - search for string in forward direction | / - search for same string in forward direction | ?string - search for string in backward direction | ? - search for same string in backward direction |
| x - delete current character | dd - delete current line (cursor placement on line irrelevant) | dw - delete word | D - delete to end of line |
| yy - yank the current line (copy to buffer) | p - put (insert but not continue insert mode) deleted or yanked item after the cursor | P - put (insert but not continue insert mode) deleted or yanked item before the cursor | "dp - put (retrieve) d-th deletion ex.: "3p |
| J - join the line below with the current line | u - undo the last command | U - restore the current line |
| numberOP - a number preceding an operation will
repeat that operation that number of times Examples: 2yy, 10x, 3dd, 5dw, 4cw |
. - (period) repeat last editing command (not cursor movement) This is useful for repeating a delete, change or an insert. |