禁用MacVim键盘快捷键 [英] Disable use of MacVim keyboard shortcuts
问题描述
有什么方法可以禁用MacVim中的键盘快捷键吗?我的意思是例如Cmd + s
之类的快捷方式,我想说服自己使用诸如:w
之类的东西,但是如果我可以使用Cmd + s
保存文件,那我做不到?
Is there any way to disable keyboard shortcuts in MacVim? I mean the shortcuts like Cmd + s
for example, I want to convince myself to use things like :w
, but I can't do so if I can save the file using Cmd + s
, you get me?
但是我当然还是想使用GUI,那么有什么方法可以禁用这些,而不必停止使用MacVim GUI?
But I of course, still want to use the GUI, so is there any way to disable these, without stoping using the MacVim GUI?
感谢您的帮助.顺便说一句,我进行了Google搜索,但找不到答案.
Thanks for your help. BTW I made a Google search and wasn't able to find an answer.
遵循@ChrisJohnsen的建议,我已经尝试了以下方法,但没有成功:
Following @ChrisJohnsen's suggestion, I have already tried the following with no success:
if has('gui_running')
macmenu File.Save key=<nop>
macmenu File.Save\ As\.\.\. key=<nop>
endif
EDIT 2:
I moved the error I'm getting over to this other question: When I try to run vim in command line I get Python errors
推荐答案
没有简单的方法来禁用所有预定义的Mac风格的键盘快捷键,但是您可以更改/禁用其中的任何快捷键.重要的命令是:macmenu
(请参阅:help :macmenu
);它使您可以设置任何Vim菜单项的Mac特定属性(主要是Mac特定的键盘快捷键和Mac特定的操作(例如,打开/保存对话框,窗口操作等).
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>
问题是,只有:macmenu
命令在您的.gvimrc
文件中时才有效.
The thing is that :macmenu
commands are only effective if they are in your .gvimrc
file.
如果执行:e $VIMRUNTIME/menu.vim
并搜索macm
,则会找到预定义的快捷方式和操作的列表.将所需的行复制到.gvimrc
,然后将key=<whatever>
替换为key=<nop>
.如果需要.gvimrc
在多个平台上工作,也可以将它们包装在if has("gui_macvim")
/endif
中.
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键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!