Vimr: Support for mapping of CMD and META keys?

Created on 26 Oct 2016  Â·  17Comments  Â·  Source: qvacua/vimr

Does VimR support mapping the CMD and META keys?

Related discussion (issues/pulls) in the neovim repo:
Feature request for mapping the CMD key: https://github.com/neovim/neovim/issues/2190
Pull request where support for mapping the CMD key was added to neovim: https://github.com/neovim/neovim/pull/4317

Also, when trying to map the META key, for example <M-1> 1gt to change the tab, the command works in terminal neovim, but not with VimR. Am I doing something wrong?

Most helpful comment

I'm also curious about "meta" key support. Neither <A-[x]> or <M-[x]> mappings seem to work for me when trying to bind the ⌥ key.

All 17 comments

I think the problem is that many CMD-{SOME_KEYs} are menu item shortcuts. We need a more thorough solution like customizable menu item shortcuts like the old VimR with MacVim backend had. That would require some time to implement. Btw: Cmd-1 is mapped to "Open file browser" (or focus it when the focus is elsewhere).

What about supporting Option key as Meta? I know that it works with Neovim in iTerm2 and Neovim.app, so I guess it can be done in VimR as well (not sure about Cmd shortcuts).

I'm also curious about "meta" key support. Neither <A-[x]> or <M-[x]> mappings seem to work for me when trying to bind the ⌥ key.

For the record, said mappings do work when running Neovim in iTerm with the ⌥ mapped "correctly".

I would also like to have an ability to map "meta" key

What's the progress of this? Or is there any plan to support this?

Perhaps worth a cross-reference to where neovim.app added this: rogual/neovim-dot-app/pull/250

I have successfully mapped the CMD key in vimr like this:

if has("gui_vimr")
  nnoremap <D-h>  :bfirst<CR>
  nnoremap <D-k>  :bnext<CR>
  nnoremap <D-j>  :bprevious<CR>
  nnoremap <D-l>  :blast<CR>
  nnoremap <D-e>  :e<Space>
  nnoremap <D-E>  :enew<CR>
endif

Yeah, cmd is fine, it's alt/option or "meta" that is not fine.

Ah, sorry, I misunderstood.

@eugenk thanks for that example of your mappings. That helped me get the MacOS tab switching commands to work, as they do in MacVim and other apps.

if has("gui_vimr")
  nnoremap <silent><D-S-{> gT
  nnoremap <silent><D-S-}> gt
endif

I have the issue of being unable to use Alt and Meta commands in the :terminal, I think this may be something I would be able to use as well. Thanks

The new snapshot has two new options for left or/and right Option key as Meta. I'll try to implement a (simple) general shortcut management soon.

You can change all key shortcuts of menu items in the latest snapshot: https://github.com/qvacua/vimr/releases

That means you can delete for example the Command-1 for "Toggle File Browser" menu item and use Command-1 for something else.

Closing... If it does not work, then please re-open.

@qvacua Mapping with CMD with a mouse click doesn't work
For example:

noremap <D-RightMouse> :GoReferrers<CR>

do nothing, but if I use Ctrl instead it works:

noremap <C-RightMouse> :GoReferrers<CR>

Does anyone know the terminal escape code for <D-CR>?
I found all the other <CR> combo escape codes:

| KeyCombo | EscapeCode |
|----------------|------------|
| \ | \ | \ | \ | \ | \ | \

UPDATE: I got an answer: https://github.com/neovim/neovim/issues/176#issuecomment-716012675

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cvincent picture cvincent  Â·  4Comments

hakamadare picture hakamadare  Â·  4Comments

robertgzr picture robertgzr  Â·  7Comments

numbcoder picture numbcoder  Â·  3Comments

crisidev picture crisidev  Â·  7Comments