Next: , Previous: Other Vi Commands, Up: Vi Commands

2.11 Insert Mode

You can enter insert mode by one of the following commands. In addition to these, you will enter insert mode if you give a change command with a line command as the motion command. Insert commands are also modifying commands and you can repeat them by the repeat command . (vip-repeat).

i
Enter insert mode at point (vip-insert).
I
Enter insert mode at the first non white character on the line (vip-Insert).
a
Move point forward by one character and then enter insert mode (vip-append).
A
Enter insert mode at end of line (vip-Append).
o
Open a new line below the current line and enter insert mode (vip-open-line).
O
Open a new line above the current line and enter insert mode (vip-Open-line).
C-o
Insert a newline and leave point before it, and then enter insert mode
(vip-open-line-at-point).

Insert mode is almost like emacs mode. Only the following 4 keys behave differently from emacs mode.

<ESC>
This key will take you back to vi mode (vip-change-mode-to-vi).
C-h
Delete previous character (delete-backward-char).
C-w
Delete previous word (vip-delete-backward-word).
C-z
This key simulates <ESC> key in emacs mode. For instance, typing C-z x in insert mode is the same as typing ESC x in emacs mode (vip-ESC).
You can also bind C-h to help-command if you like. (See Customizing Key Bindings, for details.) Binding C-h to help-command has the effect of making the meaning of C-h uniform among emacs, vi and insert modes.

When you enter insert mode, VIP records point as the start point of insertion, and when you leave insert mode the region between point and start point is saved for later use by repeat command etc. Therefore, repeat command will not really repeat insertion if you move point by emacs commands while in insert mode.