I'd really like to be able to map the caps lock key to Ctrl
, but only in vim. I saw this, but I'm using OS X. Is there an OS X alternative to AutoHotKey, or is there another way to create an application-specific mapping for a modifier key?
Asked
Active
Viewed 2,152 times
2

Community
- 1
- 1

Adam Incera
- 117
- 1
- 5
-
Possible duplicate: [Using Caps Lock as Esc in Mac OS X](http://stackoverflow.com/questions/127591/using-caps-lock-as-esc-in-mac-os-x) – mMontu Aug 27 '14 at 15:58
-
[This answer](http://stackoverflow.com/a/249923/660921) seems to do what you want? – Martin Tournoij Aug 27 '14 at 16:18
-
Just realized I actually definitely would like to to map it to `Ctrl` and edited my question. @Carpetsmoker I tried Seil (the current version of PCKeyboardHack) and it seems that it doesn't have any way of creating application-specific mappings. – Adam Incera Aug 27 '14 at 16:48
-
Terminal vim or macvim. It is probably easier to do in macvim then Terminal vim. (Probably almost impossible for it to behave nicely with terminal vim) – FDinoff Aug 27 '14 at 18:22
-
@FDinoff Oh dear. I was hoping for Terminal vim...if I could create an app-specific mapping for all of Terminal, would that do it? That would be fine with me. – Adam Incera Aug 27 '14 at 20:21
1 Answers
4
This will change caps lock to control in Terminal. I don't believe there is a good way to tell when Terminal is running vim.
- Download and install Seil and Karabiner
- Open Seil and change caps lock to key code 110 (PC Application key)
Open Karabiner and edit private.xml (Misc & Uninstall (Tab) -> Open Private Xml (Button)). Add add the following between the root elements.
<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>
Click Reload XML on the Change Key tab
- Check the following items (They should appear at the top of the box)
At this point you should be able to use caps lock as control in terminal (and iterm2) and caps lock as caps lock every where else. Caveat, If you go into terminal when caps lock is on you won't be able to shut it off.
(You might need to set CapsLock to No Action in System Preferences -> Keyboard -> Modifier Keys)
If you want this to also work in MacVim change
<only>TERMINAL</only>
to
<only>TERMINAL, VI</only>

FDinoff
- 30,689
- 5
- 75
- 96
-
also capslock led will no longer lit as it will be handled by `Seil/Karabiner`! – Paschalis Apr 06 '16 at 14:41