2.4. More Ways to Insert Text
You have inserted text before the cursor with the sequence:
itext to be insertedESC
You've also inserted text after the cursor with the a command. There are other insert commands for inserting text at different positions relative to the cursor:
A
Append text to end of current line.
I
Insert text at beginning of line.
o
Open blank line below cursor for text.
O
Open blank line above cursor for text.
s
Delete character at cursor and substitute text.
S
Delete line and substitute text.
R
Overstrike existing characters with new characters.
All of these commands place you in insert mode. After inserting text, remember to press ESC to escape back to command mode.
A (append) and I (insert) save you from having to move your cursor to the end or beginning of the line before invoking insert mode. (The A command saves one keystroke over $a. Although one keystroke might not seem like much of a saving, the more adept—and impatient—an editor you become, the more keystrokes you will want to omit.)
o and O (open) save you from having to insert a carriage return. You can type these commands from anywhere within the line.
s and S (substitute) allow you to delete a character or a whole line and replace the deletion with any amount of new text. s is the equivalent of the two-stroke command c SPACE and S is the same as cc. One of the best uses for s is to change one character to several characters.
R ("large" replace) is useful when you want to start changing text, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access