vi Editor: Commands: Insert Text
The main way to put text in your buffer in vi is via insert. Several commands
enter "insert" state:
- i - insert text right here
- a - insert text to the right of right here
- A - insert text at the end of the line
- I - insert text at the beginning of this line
- o - insert text on a following blank line
- O - insert text on a preceding blank line
Insert state is terminated with the ESC key. You can also terminate insert with
CTRL-c but that aborts the insert state, and your text is lost. Note that
insert state is line oriented. When you have finished inserting each line, that
line is in the buffer to stay.
Several control characters have special meaning to vi when you are inserting
text, so they will cause actions rather than be inserted. Do not be alarmed,
this kind of ragged non-parametric functionality is common in vi.
The following key combinations work within Insert state:
- Delete - erase last character
- CTRL-w - erase last word
- CTRL-u - erase this entire insert line
- \ - quote next character
- CTRL-v - Insert a non-printable character