<esc>
and <C-c>
are mostly similar.
They will differ in some cases such as the following:
- Doing a vertical insert (
<C-v>
, then going down, then i
to insert the same character, or text, on multiple lines): <esc>
will leave the insert mode and insert the typed text on the selected lines, whereas <C-c>
will leave the insert mode and will only insert the text where the cursor was (cancelling the vertical insert).
- When using
input()
, the behaviour changes, cf: https://stackoverflow.com/a/56163617/3866623
<n>i
, as in your question, esc
will insert n
times what you typed, <C-c>
will cancel the input and insert it once.
<C-c>
is pretty much cancelling the action and going back in Normal mode.
If you want an alternative to <esc>
, <C-[>
(CTRL-[
) is doing exactly the same, in case you don't have an escape key.
For reference, :help i_CTRL-[
and :help i_CTRL-C
:
<Esc> or CTRL-[ End insert or Replace mode, go back to Normal mode. Finish
abbreviation.
Note: If your <Esc> key is hard to hit on your keyboard,
train yourself to use CTRL-[. If Esc doesn't work and you
are using a Mac, try CTRL-Esc. Or disable Listening under
Accessibility preferences.
CTRL-C Quit insert mode, go back to Normal mode. Do not check for
abbreviations. Does not trigger the InsertLeave autocommand
event.