This state is entered through Vi replacement commands, such as C,
cw, etc., or by typing R. In Replace state, Viper puts <R> in
the mode line to let you know which state is in effect. If Replace state is
entered through R, Viper stays in that state until the user hits
ESC
. If this state is entered via the other replacement commands,
then Replace state is in effect until you hit ESC
or until you cross
the rightmost boundary of the replacement region. In the latter case, Viper
changes its state from Replace to Insert (which you will notice by the
change in the mode line).
Since Viper runs under Emacs, it is possible to switch between buffers while in Replace state. You can also move the cursor using the arrow keys (even on dumb terminals!) and the mouse. Because of this freedom (which is unattainable in regular Vi), it is possible to take the cursor outside the replacement region. (This may be necessary for several reasons, including the need to enable text selection and region-setting with the mouse.)
The issue then arises as to what to do when the user
hits the ESC
key. In Vi, this would cause the text between cursor and
the end of the replacement region to be deleted. But what if, as is
possible in Viper, the cursor is not inside the replacement region?
To solve the problem, Viper keeps track of the last cursor position while it was still inside the replacement region. So, in the above situation, Viper would delete text between this position and the end of the replacement region.
Insert State States in Viper