I am trying to map Ctrl( in insert mode. However, Vim does not recognize the key binding. This is what I currently have:

" Insert a pair of brackets using Ctrl-(
inoremap <C-(> ()<left>

Why does vim ignore the key binding?


Vim does not ignore the keybinding. It just can't be reliably detected. See the faq:

The only Ctrl-printable-key chords which Vim can reliably detect (because they are defined in the ASCII standard) are the following:

    Ctrl-@                 0x00            NUL
    Ctrl-A to Ctrl-Z       0x01 to 0x1A
    Ctrl-a to Ctrl-z       0x01 to 0x1A
    Ctrl-[                 0x1B            ESC
    Ctrl-\                 0x1C
    Ctrl-]                 0x1D
    Ctrl-^                 0x1E
    Ctrl-_                 0x1F
    Ctrl-?                 0x7F            DEL

Most of these, however, already have a function in Vim (and some are aliases of other keys: Ctrl-H and Bsp, Ctrl-I and Tab, Ctrl-M and Enter, Ctrl-[ and Esc, Ctrl-? and Del).

The "safest" keys to use in Vim for the {lhs} of a mapping are the F keys, with or without Shift: to and to . (Some OSes, including mine, intercept Ctrl-Fn and Alt-Fn, which never reach an application program such as vim or gvim).

You can try other combinations of Ctrl + any key, but they may either not work everywhere (e.g. the terminal might not pass that key to Vim, or they might have unintended side effects (e.g. mapping means also to map ).


Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. https://groups.google.com/forum/#!topic/vim_dev/Ym6D-kWIsyo

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.


Try inoremap <C-9> ()<Left>. It seems that Vim does not recognize the ( in insert mapping.

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