The following are keyboard commands used in the "vi" editor:
| H | move cursor to first line of screen (Home) |
| M | move cursor to middle of screen |
| L | move cursor to last line of screen |
| j | move cursor down one line |
| k | move cursor up one line |
| l | move cursor right one character |
| h | move cursor left one character |
| w | move cursor forward one word |
| b | move cursor back one word |
| e | move cursor to end of word |
| dw | delete current word |
| dd | delete current line |
| d<cr> | delete two lines |
| x | delete character |
| xp | transposes (swaps) characters "ea" for "ae" |
| D | delete from cursor to end of line |
| u | undo last command (toggles) |
| r | replace character |
| R | replace continuously one character at a time <esc> |
| G | go to last line in file |
| 35G | go to line 35 |
| ^ | go to beginning of current line |
| $ | go to end of current line |
| J | join current line and next |
| - | go to first character of previous line |
| . | repeat previous command (dot) |
| ~ | change case -- upper <-> lower |
| y | yank word(s) |
| Y | yank line(s) |
| p | "paste" text after cursor |
| P | "paste" text before cursor |
| ZZ | Write and Quit |
| Move | Move | Move | Move |
| Left | Down | Up | Right |
| h | j | k | l/sp |
| B/B | + | - | w/W |
| i | insert text (at cursor) |
| I | insert text at the beginning of the current line |
| a | add text (following cursor) |
| A | add text to the end of the current line |
| o | open line below cursor |
| O | open line above cursor |
| c | change (must be used with a movement key like "w") |
| C | change to end of line |
| s | substitute for present character |
| S | Substitute for entire line |
[ NOTE: When you type one of these characters, everything you type goes into the file until you hit the <escape> key ]
(c)Copyright 1985, 1996 by Bruce JonesAnyone is free to reproduce any of these documents in their entirety or parts thereof providing:
Bruce Jones Department of Communication bjones@ucsd.edu University of California, San Diego (619) 534-0417/4410 9500 Gilman Drive FAX (619) 534-7315 La Jolla, Ca. 92093-0503
This page last updated on: Feb 3 1997