On OS X, I've changed Caps-Lock to CTRL in the Keyboard Modifier settings. It's great, but I'd like to use CTRL CTRL (a quick double-tap) to ESC in VIM (my pinky is resisting CTRL [ ). Possible?
Already using au CursorHoldI * stopinsert
and set ut=2000
to exit Insert Mode
after two seconds, but some plugins interfere (completion, most often).
Aside: Could this, if possible, create a conflict with Tmux ?
You cannot map Ctrl by itself in Vim at all, let alone Ctrl Ctrl . It is strictly a modifier key.
As @echristopherson mentioned, Karabiner can do some serious remap wizardry…
Jumping off his suggestion, I found the Karabiner documentation and came up with:
<?xml version="1.0"?>
<root>
<item>
<name>Ctrl Freak</name>
<identifier>private.double_ctrl_to_escape</identifier>
<autogen>
__DoublePressModifier__
KeyCode::CONTROL_L, KeyCode::CONTROL_L,
KeyCode::ESCAPE
</autogen>
</item>
</root>
I have done some quick testing with it, but from first blush, seems to perform without issue on OSX, SUBLIME TEXT, and VIM (within a TMUX session).
Keep in mind:
This is a system wide solution though. For me, that's a good thing. I use a 60% keyboard and need to make the most of my real estate.
For a VIM specific solution:
You will need to add that bit. The documentation can be found here .
Cheers!
The free program Karabiner (formerly KeyRemap4MacBook) can do many remapping things of that nature. I don't know specifically about double keypresses, but I know it can be made to treat a single tap of Ctrl as Esc , while treating Ctrl held down for a configurable amount of time)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.