19

Is it possible to map a vim command to a combination of keys involving more than one modifier? For example: ctrl-alt-v.

As far as I can tell, the only modifier key that can be used in combination with another is shift. e.g. <C-v> and <C-V>. Or am I missing something?

3 Answers 3

17

Yeah, you would map <C-A-v> or <C-M-v> (A, Alt, and M, Meta are equivalent concepts). See :help key-notation.

Sign up to request clarification or add additional context in comments.

4 Comments

This DOES NOT WORK in Macvim. Vim won't complain but modifiers after the first are ignored. So if you do <C-S-h> for example, the shift is ignored. I can't say for other versions of vim.
It doesn't work (for me, at least) in (normal, terminal-based) vim on a Mac either, so it doesn't appear to be specifically a MacVim issue, but rather an issue with vim on a Mac.
Odd. the help only mention Shift with the F keys, but not even that works for me. no modifier allowed with Fkey it seems.
To expand on @sean's comment - If you're using MacVim, see: this superuser question
4

There's also this script (arpeggio) that allows you to use two or more simultaneously pressed keys (any keys, not just modifiers keys like shift, alt, etc.) in your mappings.

2 Comments

Cool, I love the name. Can I use it to play Bach?
Great plugin, very intuitive once it's set up. For example, I can type one bracket like normal then some code and then the closing bracket or I can just map [] to []<Left> and hit them both at the same time ending up inside the brackets. Better yet, it saves on boilerplate, ie Arpeggio inoremap pc <Esc>biclass <Esc>ea():<Left><Left> for python class. Thanks for posting!
1

They can be combined just fine, like this for example: <C-M-v> maps CTRL-Alt-v.

Meta (Alt) is M, Shift is S, and CTRL is C.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.