MacVim: Re-map command key combinations like <d-f>
I can remap unused combinations like <d-1>
(Cmd+1) in MacVim, but there are many combinations like <d-f>
, <d-o>
or <d-b>
that are already bound to MacVim menu items. If I try to remap those inside my .vimrc, nothing changes.
Is there some way I can remap those combinations inside MacVim, or stop MacVim from assigning them to menu items so they are properly passed on to the Vim core?
Found it: Command-T recommends using the following snippet:
if has("gui_macvim")
macmenu &File.New\ Tab key=<nop>
map <D-t> :CommandT<CR>
endif
So basically you unmap the respective menu item, and then you are free to map the shortcut you were trying to map. (I'm not sure what the ampersand is doing; it works with and without it.)
This must be put in ~/.gvimrc, not ~/.vimrc! (Apparently ~/.vimrc is read too early, so the (un)mappings will be clobbered if you put them there.)