In MacVim, the Command key has default menu bindings (e.g. <D-o> is mapped to Open File). Sadly, these mappings cannot be overwritten directly through .vimrc.

Here is the trick to unmap the unwanted <D-> bindings. Put the snippet in .gvimrc:

if has("mac")
    " Unmap Commnd + t
    macmenu File.New\ Tab key=<nop>
    " Unmap Commnd + o
    macmenu File.Open\.\.\. key=<nop>
    " Unmap Commnd + T
    macmenu File.Open\ Tab\.\.\. key=<nop>
    " Unmap Commnd + p
    macmenu File.Print key=<nop>
    " Unmap Commnd + f
    macmenu Edit.Find.Find\.\.\. key=<nop>
endif

Additionally, to enable Alt/<M-> key mappings on MacVim (in .vimrc):

if has("gui_macvim")
  set macmeta
endif

View my Vim settings.

Comments