I tried entering the key sequence <esc>+<n>+i+<some-char>+<esc> and it'll type <some-char> <n> times.

But if I'm using a macbook keyboard there is no escape key, so I tried this instead <CTRL+C>+<n>+i+<some-char>+<CTRL+C>, and it didn't type <some-char> <n> times; is there an alternative way to do this on a Macbook, or when you don't have an esc key?

  • Wdym no escape key? Is this a macbook with a touchbar? There is an esc on the touchbar, afaik
    – D. Ben Knoble
    May 18, 2019 at 20:15
  • I'm not talking about a particular Macbook. I had one some years ago from work and it didn't have an esc key and drove me nuts!
    – leeand00
    May 18, 2019 at 20:22
  • Mine has esc. Thats bizarre. Ctrl-C cancels sometimes, cancelling the effects of some operations
    – D. Ben Knoble
    May 18, 2019 at 20:24
  • Ah wait sorry, now I remember, it was a MacBook Air. And that was a MacBook Error.
    – leeand00
    May 18, 2019 at 22:50

1 Answer 1


<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 
                   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    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.