0

I'm running vim -u NONE -U NONE, then doing :inoremap <c-c> <c-[> (or :inoremap ^C ^[, which I understand to be equivalent), and set an abbreviation, :abb dyca dynamic_cast.

The problem is that idyca<ESC> correctly inserts dynamic_cast, while idyca<C-C> inserts dyca.

I'm able to remap <c-c> to the character 'O' to verify that you can correctly remap <c-c> but it doesn't seem to allow for rebinding Ctrl-C to Escape.

What am I doing wrong?

  • 2
    I have the same behaviour in vim and gvim. I think Vim is checking just for the Escape key, rather than a mapping. At least, that what I think it is after glancing at the Vim source code in src/edit.c (edit() function, around line 980 onwards), but I'm not 100% sure as it's rather difficult to follow... – Martin Tournoij Jul 8 '17 at 10:42
1

I'm not sure why <C-C> does not trigger of an abbreviation after :inoremap <C-C> <C-[>, but if you :inoremap <C-C> <C-]><C-[> abbreviations are correctly expanded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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