Disable use of MacVim keyboard shortcuts

末鹿安然 提交于 2019-11-30 07:11:31

There is no simple way to disable all of the pre-defined Mac-style keyboard shortcuts, but you can definitely change/disable any of them. The important command is :macmenu (see :help :macmenu); it lets you set the Mac-specific properties of any Vim menu item (mostly Mac-specific keyboard shortcuts and Mac-specific actions (e.g. open/save dialog boxes, window manipulations, etc.)).

macmenu File.Save key=<nop>
macmenu File.Save\ All key=<nop>
macmenu File.Save\ As\.\.\. key=<nop>

The thing is that :macmenu commands are only effective if they are in your .gvimrc file.

If you do :e $VIMRUNTIME/menu.vim and search for macm, you will find the list of pre-defined shortcuts and actions. Copy the desired lines to you .gvimrc and replace key=<whatever> with key=<nop>. You can also wrap them in if has("gui_macvim") / endif if you need your .gvimrc to work on multiple platforms.

MacVim has only one "advantage" over plain Vim: it supports native Mac OS X shortcuts. If you don't want those shortcuts you might as well simply use plain Vim.

FWIW, when I switched from TextMate I, too, found after a while that these native shortcuts were an obstacle on my way to learning Vim. My solution was to focus my efforts on plain Vim. After a week in the terminal you should be able to completely disregard those shortcuts.

I'd advise you to take a little pause and think about doing things in a more appropriate order:

  1. In the terminal, do $ vimtutor as many times as needed.

  2. In the terminal again, use $ vim for simple tasks first then more complex tasks. There's a predictable productivity hit at the beginning but it will last only a few days/weeks.

  3. Once you have reached your previous level of productivity, you can start to fly Vim full-time. At that point, using MacVim or GVim or plain $ vim should make no difference whatsoever.

Bonus points for not relying too much on plugins, other people's vimrcs or "distributions" like janus or spf13…

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!