Difference between append and insert mode in Vim




vim commands pdf (3)

Another important aspect on Append is that if the position after the current position is a empty space followed by a word. After you are done writing it will concatenate both words.

E.g. A file with the following text:

Hi there.

With the cursor on i. After pressing the a button and then ESC you would have:

Hithere.

I noticed this accidentally when playing around in vimtutor. What's the difference between append and insert mode in Vim? When I type a in normal mode (not A) I can insert text. When should I use one and not the other?


Answer #1

Note that vimtutor doesn't initially make the case of the command obvious:

SHIFT+A (capital A, as opposed to a) the cursor moves to the end of the current line.

SHIFT+I (capital I, as opposed to i)moves to the start of the current line.


Answer #2

The append command will put the cursor after the current position, while the insert command will put the cursor before it.

Using the append command is like moving the cursor one character to the right, and using the insert command.

Using the insert command is like moving the cursor one character to the left, and using the append command.

You choose which depending on where you want to start typing.





vim