I have Vim EasyMotion running by pressing:

Backslash Backslash <key>

I want to map this as Ctrl+, so I can do Ctrl+, <key>:

map <C-,> <Bslash><Bslash>
map <C-,> \\

But none of them worked. Has the backslash be escaped somehow?

share|improve this question
up vote 4 down vote accepted

TL;DR: <C-,> won't work; choose another key combination.

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

According to :help map_backslash, you are right to use <Bslash>. The problem is that vim does not seem to recognize <C-,> in the :map command. For example,

:map <C-,> :echo 'foo'<CR>

does not have the expectred effect. Either dig into this further or choose a different key.

share|improve this answer

Your Answer

 
discard

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.