我真的很希望能够将大写锁定键映射到 Ctrl
,但仅限于 vim。我看到this ,但我使用的是 OS X。OS X 是否有 AutoHotKey 的替代方案,或者是否有其他方法可以为修饰键创建特定于应用程序的映射?
最佳答案
这将更改大写锁定以在终端中进行控制。我不相信有一个好的方法来判断终端何时运行 vim。
- 下载并安装 Seil和 Karabiner
- 打开 Seil 并将大写锁定更改为 key 代码 110(PC 应用程序 key )
打开 Karabiner 并编辑 private.xml(杂项和卸载(选项卡)-> 打开私有(private) Xml(按钮))。在根元素之间添加以下内容。
<name>Change PC Application Key to CONTROL (Menu Key in TERMINAL)</name> <item> <only>TERMINAL</only> <name>Change PC Application Key to CONTROL (Menu Key in TERMINAL)</name> <identifier>remap.termianl_application2control</identifier> <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::CONTROL_L</autogen> </item> <name>Change PC Application Key to CAPSLOCK</name> <item> <name>Change PC Application Key to CAPSLOCK</name> <identifier>remap.other_application2capslock</identifier> <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::CAPSLOCK</autogen> </item>
单击“更改 key ”选项卡上的“重新加载 XML”
- 检查以下项目(它们应出现在框的顶部)
此时,您应该能够在终端(和 iterm2)中使用大写锁定作为控制,并在其他地方使用大写锁定作为大写锁定。注意,如果您在大写锁定打开时进入终端,您将无法将其关闭。
(您可能需要在系统偏好设置 -> 键盘 -> 修饰键中将 CapsLock 设置为无操作)
如果您希望这也适用于 MacVim 更改
<only>TERMINAL</only>
到
<only>TERMINAL, VI</only>
关于macos - 映射大写字母仅在 vim 中锁定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25531572/