5

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?

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

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!

3
  • Is *type on your keyboard* really part of the command? Sep 17 '17 at 20:00
  • 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. Sep 18 '17 at 4:45
  • 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. Sep 18 '17 at 4:48
1

I'm using a UK keyboard where underscore is shift-minus, and I found I could map a key to <C-_> (i.e. control-underscore) and it works with control-minus (though as @Thomas says above, not in a terminal window because that's predefined to zoom out)

I couldn't find that documented anywhere - it was just a hunch. I'm not sure what would happen on other keyboards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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