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>

2 Answers 2


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
  • 2
    Also, please see the faq: vimhelp.org/vim_faq.txt.html#faq-20.5 Mar 29, 2019 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, 2019 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, 2019 at 4:47
  • Well, on a mac at least <C-6> doesnt work, you have to use <C-^>
    – D. Ben Knoble
    Feb 27, 2020 at 6:03

I had a similar issue, when I wanted to map Ctrl+4 and Ctrl+6 keys, but those codes were not recognized. The output of Ctrl+vCtrl+4 was ^[[1;5t, which usually would lead to a mapping like e.g.

map ^[[1;5t <End>

but that did not work. The solution was to replace ^[ with <ESC> in the mapping command, like e.g.:

map <ESC>[1;5t <End>
imap <ESC>[1;5t <End>
  • Note: ■ Generally speaking, mapping raw key sequences like shown is not a good idea, as then pressing <esc> will be delayed. ■ of course you can write ^[ directly in vim editor, just enter it as the raw escape byte (by <c-v><esc>, the ^[ should be colored blue)
    – user202729
    Feb 17, 2023 at 2:34

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.