Entering insert mode at different locations
The vim help documents have a great section on this: :help inserting
A quick summary is:
i
: Insert before the cursor.
I
: Insert before the first non-blank character of the line.
a
: Insert after the cursor.
A
: Insert at the end of the line.
o
: Begin a new line below the current line and insert.
O
: Begin a new line above the current and insert.
gI
: Insert at column 1 of the line.
gi
: Insert where insert mode was last stopped.
Insert commands take a count as well, so you can type 3itest<space><esc>
to get:
test test test
Insert commands can be repeated with .
as well, so itest<space><esc>..
will yield (because the i
inserts before the cursor, which is on the space):
testtesttest
Finally, I'll add
EvergreenTree's answer
from the comments: You can enter insert mode with :star[tinsert][!]
which
works like i
unless you give it the option !
, in which case it works like
A
.
Modifying text and then entering insert mode
It is also possible to modify the text in normal mode and enter insert mode at
the end. See :help replacing
. A summary of the commands are as follows:
c
: Delete text (and yank to the buffer) and enter insert mode.
cc
: Delete the line and enter insert mode.
C
: Delete until the end of the line and enter insert mode.
s
: Delete a number of characters and enter insert mode.
S
: Delete a number of line and enter insert mode.
Many of these also work on visually selected text.
:h inserting
- also:h replacing