Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to map Ctrl period and Ctrl comma in Vim?

Tags:

vim

I can't seem to find a way to map <control> period and <control> comma in Vim. Is it possible?

like image 483
double free Avatar asked Nov 07 '11 07:11

double free


2 Answers

According to the FAQ it looks like you're out of luck with <C-.> and <C-,>, since this key combination is not in the list of Ctrl-printable-key chords that Vim can detect (Vim can only map to printable ASCII chords).

like image 148
Prince Goulash Avatar answered Sep 18 '22 19:09

Prince Goulash


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.

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.

like image 27
Ingo Karkat Avatar answered Sep 21 '22 19:09

Ingo Karkat