In order to switch interactively
between GNU Emacs and vi
editing modes, use the command M-C-J
(toggle-editing-mode).
When you enter a line in vi
mode, you are already placed in ‘insertion’
mode, as if you had typed an ‘i’.
Using Esc
switches you into ‘edit’
mode, where you can edit the text of the line with the standard vi
movement keys, move to previous history lines with ‘k’,
and following lines with ‘j’,
and so forth.