MacVim:知道为什么我无法覆盖命令按钮吗?
我正在尝试使用 MacVim 中的命令按钮而不是 Ctrl 和其他按钮。
我尝试了类似 :imap
在 MacVim 中覆盖正常的命令空间功能,但它仍然执行聚光灯。
有什么想法吗?
I am trying to use the command button in MacVim instead of Ctrl and other buttons.
I tried something like :imap <D-space> <Esc>
to override the normal Command-space functionality while in MacVim but it still performs the spotlight.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这些情况下,窗口管理器通常会在应用程序看到击键之前拦截该击键。当指定的应用程序处于活动状态时,可能有一个选项可以关闭某些全局键绑定,但我无法在 10.5 上找到它 - Linux 窗口管理器具有此功能,Windows 也是如此,所以我希望它隐藏在某个地方在操作系统 WM..
In these cases its usually the window manager intercepting the key-stroke before the application ever sees it. There may be an option to turn off certain global key-bindings when a specified app is active but I've been unable to find it on 10.5 - linux window managers have this functionality, as does windows, so I'd expect its hiding somewhere in the OS WM..
Spotlight 快捷方式优先于您自己的快捷方式。
为了能够在 MacVim 中使用它,您必须在其首选项中更改 Spotlight 的快捷方式。
但是,Command 密钥在 Terminal.app 中不起作用,也不会发送到通过 SSH 连接的远程服务器。如果您在服务器上使用 Vim,您将无法使用它,并且您将被迫创建和学习大量特定于机器的映射或简单地使用默认值。
我一开始就遇到的另一个可能的问题是,具有多个修饰键的快捷键(例如
或
)不适用不能在 MacVim 中工作。由于这个原因以及使用这些键的本机快捷键的数量,您不会有太多的可能性。
当我决定学习 Vim(使用 MacVim)时,我尝试了很多方法来使其(和 Vim)更加“像 Mac”或“像 TextMate”,但都无济于事。
相反,我建议你按照 Vim 的方式做事。这可能看起来很奇怪,但这是值得的。
就您而言,“Vim 方式”是使用
mapleader
,它是键盘上用于自定义映射的常规键。默认键是\
,如果您想更改它(例如,更改为,
,这是我的设置,但 YMMV),请将此行添加到您的~/ .vimrc
:之后您可以创建如下映射:
The Spotlight shortcut takes precedence over your own shortcut.
To be able to use it in MacVim you must change Spotlight's shortcut in its preferences.
However, the Command key won't work in Terminal.app and won't be sent to remote servers connected by SSH. If you use Vim on a server you won't be able to use it and you will be forced to either create and learn lots of machine-specific mappings or simply use the defaults.
Another possible issue, one I encountered at the beginning, is that shortcuts with multiple modifier keys (like
<D-M-something>
or<C-S-something>
) don't work in MacVim.Because of that and the number of native shortcuts using these keys you won't have many possibilities.
When I decided to learn Vim (with MacVim), I tried a lot of things to make it (and Vim) more "Mac-like" or "TextMate-like" to no avail.
Instead i suggest you to do things the Vim way. It may seem weird but it's worth it.
In your case, the "Vim way" would be to use
mapleader
, it's a regular key on your keyboard that is used for custom mappings. The default key is\
, if you want to change it (to,
for the example, that's my settings but YMMV), add this line to your~/.vimrc
:After that you can create mappings like this: