Question about mapping C-C in macvim

Skip to first unread message

Filippo Salustri

May 22, 2020, 7:31:35 AM5/22/20
to vim_mac
I have this in my .vimrc: nnoremap <C-X><C-F> :edit<Space> and it works fine.

But this: nnoremap <C-X><C-C> :edit<Space> doesn't work.
It produces the message: Type :qa and press <Enter> to exit Vim 
Even this: nnoremap <C-a><C-c> :echo 1<CR> produces the same message.

The only difference is the <C-C>. 
Every other binding I have works fine.  None of them rebind <C-C>.

I have looked everywhere I know, and I cannot find an explanation.
Can someone help me diagnose this?

Aymen Hafeez

May 23, 2020, 7:08:41 AM5/23/20
I tested the command on Linux and it seems to work as expected, so I
don't know if this is a macvim specific issue. In normal mode CTRL-C
aborts the pending command, but from :help map-CTRL-C,

"Using CTRL-C in the {lhs} is possible, but it will only work when Vim
is waiting for a key, not when Vim is busy with something. When Vim is
busy CTRL-C interrupts/breaks the command. When using the GUI version on
MS-Windows CTRL-C can be mapped to allow a Copy command to the
clipboard. Use CTRL-Break to interrupt Vim.",

so it should work. Have you tried it in Vim from the terminal?


-- Aymen --

Filippo Salustri

May 23, 2020, 10:22:55 AM5/23/20
to vim_mac
I have an answer: Thanks to a redditor (link to reddit thread here): bind <C-C> to something on its own before using it for anything else - e.g., I put nnoremap <C-c> :echo 1<Cr> before any bindings involving <C-C> and now it works on all my platforms, vim, gvim, macvim on Mac and crostini.
Reply all
Reply to author
0 new messages