Vim map key combination of Control and Dash

3

Is it possible to bind <C--> (or <C-dash> or <C-minus>, I actually do not know) in vim to something, like <C-W><C-Q>?

What does it mean <C--> in the default binding?

user14416

Posted 2015-04-30T20:28:50.707

Reputation: 298

Answers

3

Perhaps you could make that binding work in gvim, but not in vim running in a terminal, because you are unlikely to find a keyboard configuration which sends a different sequence of characters for control/Minus. As a rule, the control modifier affects only a few non-alphabetic characters.

Here is a screenshot from vttest, which happens to illustrate the usual set of control keys:

enter image description here

Thomas Dickey

Posted 2015-04-30T20:28:50.707

Reputation: 6 891

1

You can set the command by typing control-v, then the key combo you want.

So for "control" + "minus", enter the following on a new line in your ~/.vimrc:

nnoremap *type on your keyboard*<ctrl-v><ctrl-minus>*end type* :MyCommand<cr>

Hopefully this makes sense!

JesseBuesking

Posted 2015-04-30T20:28:50.707

Reputation: 119

Is *type on your keyboard* really part of the command? – G-Man Says 'Reinstate Monica' – 2017-09-17T20:00:54.703

No. That's my way of saying "literally enter these keystrokes". My explanation is an attempt to show you a mixture of the actual text that would appear in your .vimrc, and what you would type at your keyboard. – JesseBuesking – 2017-09-18T04:45:50.877

To whoever down-voted: did you try this and it did not work for you? I ask because earlier today I was looking to setup control+minus myself, and this is what I did to get it working. – JesseBuesking – 2017-09-18T04:48:09.040