Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In vim, if you are in block insert mode (Ctrl-V, Shift-I) and exit using Ctrl-C (instead of Esc), it cancels the block edit (and only edits the first row).

Why is this? In almost all other contexts, Ctrl-C and Esc are synonymous. (And ideally there's a way to fix this -- I've now gotten used to doing Ctrl-C and it would be a shame if I had to relearn…)

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Ctrl-c and Esc are not guaranteed to be synonymous, and often differ. For example, in Insert mode, Esc will trigger abbreviations and go to Normal mode, whereas Ctrl-c will not trigger abbreviations nor the InsertLeave autocommand and go straight to Normal mode. Another example is in the old vi command line mode, Esc would actually execute the command as if you had hit Enter. Vim deliberately changed this because that behavior was deemed unintuitive and surprising, but you can still enable it by adding x to 'cpoptions'.

As for the blockwise visual operators, the blockwise-operators help tag has the following documentation:

Visual-block Insert                     *v_b_I*
With a blockwise selection, I{string}<ESC> will insert {string} at the start
of block on every line of the block, provided that the line extends into the
block.  Thus lines that are short will remain unmodified.  TABs are split to
retain visual columns.

Notice that only Esc is mentioned, not Ctrl-c.

So, no, Ctrl-c and Esc are not equivalent. It is never a shame to disabuse oneself of a misconception. Once you have realized that, you can decide what to do next. Immediately obvious options are to learn the differences and use the correct key, or decide that you don't need the functionality of one of the keys and remap it to match the other.

share|improve this answer
Gotcha. For now I'll vnoremap <C-c> <Esc> but I'll keep what you said in mind. –  Ben Alpert Jul 5 '12 at 21:32
add comment

Try :map ^C esc where "^C" is entered via CTRL+v then CTRL+c.

share|improve this answer
Can you explain why this is necessary? What other side effects might it have? –  Ben Alpert Jun 5 '12 at 18:50
They serve slightly different functions. CTRL+C conventionally means "cancel this action" (in a unix-like context). Cancelling the action in your vim context means "stop what is happening and go back to normal mode". Escape in vim means, "I've finished go back to normal mode". –  donothingsuccessfully Jun 5 '12 at 18:59
As to side-effects, I didn't notice any. CTRL-C after :!cat still seems to have the desired effect after the map. If you encounter problems you could try, e.g. stty intr \^k at the shell prompt to change the terminal's interrupt character to CTRL-k. –  donothingsuccessfully Jun 5 '12 at 19:04
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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