I am using macvim 8.1, the map command is

:inoremap <C-$> <End>

I also tried <C-4>, no working.

tried other number, can't work too (however CTRL-6 could work).

Also tried nnoremap, same result.

the :map <C-$> command shows

i <C-$>      * <End>

Normally Ctrl-Number produce a different key code. You can check like this:

Open Vim and change to insert mode. Then hit Ctrl-V followed by Ctrl-4 (or whatever you plan to map).

On Linux this produces the output ^\. Note that this is one character, usually displayed in light-blue. So Ctrl-4 is identical to Ctrl-\.

Tested with Vim 8.1 on Ubuntu in Gnome-Terminal (but should be true for all systems):

  • Ctrl-1 is not detected
  • Ctrl-2 is Ctrl-@ (hex 0x00)
  • Ctrl-3 is Ctrl-[ aka ESC
  • Ctrl-4 is Ctrl-\
  • Ctrl-5 is Ctrl-]
  • Ctrl-6 is Ctrl-^
  • Ctrl-7 is Ctrl-_
  • Ctrl-8 is Ctrl-? aka Delete used as Backspace
  • Ctrl-9 is not detected
  • Ctrl-0 is not detected
  • 1
    Also, please see the faq: vimhelp.org/vim_faq.txt.html#faq-20.5 – Christian Brabandt Mar 29 at 10:51
  • If Ctrl-3 is identical to ESC, I should expect vim quit insert mode to normal mode when Ctrl-3 is pressed, like ESC usuallly does, however, actually, 3 is input, so Ctrl-3 shouldn't be the same as ESC or Ctrl-[, should it? – chrisyue Apr 1 at 2:16
  • @chrisyue <Ctrl-3> leaves insert mode. Tested in Vim, GVim, and the vi-editing-mode of Bash (Gnome-Terminal, XTerm). – Ralf Apr 1 at 4:47

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.