Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I map holding down Ctrl and pressing ; in Vim?

It doesn't work on my Linux terminal. Ctrl-l works fine after putting <c-l> some_action in my vimrc, but <c-;> some_action does nothing.

share|improve this question
This question is answered here: stackoverflow.com/questions/11924358/how-to-remap-c/… – Birei Aug 19 '12 at 21:21
This depends on your terminal emulator. You need to convince it to send some escape sequence for Ctrl+;. See How to fix Ctrl + arrows in Vim? or How do I bind the tmux prefix to a Super? for background. What terminal emulator are you using? – Gilles Aug 20 '12 at 0:46
I am using L-Ubuntu 11.04, which is XFCE, so I guess I'm using 'terminal'. en.wikipedia.org/wiki/List_of_terminal_emulators – Hermann Ingjaldsson Aug 20 '12 at 6:23
when i do ctrl-v ctrl-; in insert mode i just get output ';' – Hermann Ingjaldsson Aug 20 '12 at 8:33
up vote 3 down vote accepted

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. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

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 8 major release.

share|improve this answer

If you are working within a GUI or a window manager of some sort, you may be able to configure it to send a different keystroke to your terminal application or Gvim application when you type Ctrl;. You would need to tell it to send a keystroke that vim understands but that is harder for you to type.

For instance, you could map Ctrl; to Ctrl^ (which I find hard to type) and then remap Ctrl^ as you like within your .vimrc.

I have done this sort of thing using Keyboard Maestro on Mac OS X. Of course, this is slightly annoying to set up and will only being usable in the environment(s) you have specially configured, but optimizing a common case can pay off in the long run.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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