From help :help i_ctrl-a
:
CTRL-A Insert previously inserted text. {not in Vi}
Let's say I have an empty buffer and I'm in normal mode.
I type i
to go in insert mode.
I type ()
, then move the cursor one character to the left by hitting <C-h>
(which I mapped to <left>
in insert mode), type foo
, and go back in normal mode by hitting escape.
The buffer contains: (foo)
I thought, wrongly, that the previously inserted text would be (foo)
but it's not.
The previously inserted text is only foo
which can be checked by typing :registers .
or hitting <C-a>
in insert mode again.
Why does hitting an arrow key reset the previously inserted text ?
Is there a way to make the dot register store all the text that was inserted the last time I went in insert mode even though I hit an arrow key ?