I am trying to map Cmd+Alt to start searching in vim (/). The only question is: how would I do this? I know to map Alt in vimscript is by typing <A> but I do not know how to do Cmd.

I also want to press the keys at the same time (not one after the other)

  • Are you using MacVim? Or Vim from a terminal? – Martin Tournoij Mar 5 '15 at 20:23
  • I am using terminal. – iProgram Mar 5 '15 at 20:23

This is not possible. In the terminal, no key code is generated for modifiers alone.

Gvim also has no support for this, partly because there is no valid way to represent the key using the map commands.

  • Oh well, Looks like I will map ll to / then. Thanks. – iProgram Mar 6 '15 at 11:37

Looking at the keycodes, towards the end of the table is:

<M-...>         alt-key or meta-key             meta alt <M-
<A-...>         same as <M-...>                 <A-
<D-...>         command-key (Macintosh only)    <D-

Combinations would look like <D-M-x>.

Though I don't think a combination of modifiers alone can be mapped (Ctrl-Shift,Cmd-Alt, etc.).

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.