Just as I and Tom mention in this thread http://groups.google.com/group/vim_mac/browse_thread/thread/b7fbb421fb38f613/0794146b93bfbb8c?lnk=gst&q=remapping+caps#0794146b93bfbb8c, the KeyRemap4MacBook prefpane together with the PCKeyboard Hack prefpane, available at http://www.pqrs.org/tekezo/macosx/keyremap4macbook/extra.html will reliably transform your caps lock key into an escape key.
It can remap lots of other keys as well. But this is pretty much all I use it for. :) Let me quote myself: Fredrik Bränström wrote: > This is the one that solved it for me. The Mac and Vim in perfect > blissful harmony - ESC on its throne, where it belongs; just to the > left of my pinky. :) On Oct 23, 11:01 pm, Britt Selvitelle <[EMAIL PROTECTED]> wrote: > It seems this has made its way into HEAD! > Is this worth of a pref in the UI? > > On Sep 30, 1:37 pm, "björn" <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > The possibility to remap Caps-Lock to function as a second Escape key > > has been brought up before. I never thought about this much before, > > but being able to use Caps-Lock as Esc really makes a whole lot of > > sense so I decided to see what could be done about this. > > > It turns out that Mac OS X lets you remap Caps-Lock to function as > > Ctrl, Alt, or Cmd, which is useful for Emacs I guess, but not so much > > with Vim. But that got me thinking: maybe the Caps-Lock key can still > > be identified by some virtual key code. If so, I could remap > > Caps-Lock to Ctrl (for instance) and then check when Ctrl was pressed > > if the actual key pressed really was Caps-Lock. Unfortunately I > > couldn't figure out a way to do this (Caps-Lock sends the same key > > code as the modifier you remap it to), so I had to hack it a bit. > > > The attached patch will let you turn one of the _left_ modifier keys > > into a sort of pseudo-Esc key: the modifier will work as usual, unless > > it is pressed and released quickly (with no intervening key presses) > > in which case it sends an Esc key event. I use it as follows: first I > > go into the System Preferences and remap Caps-Lock to Ctrl. Then I > > can happily use Caps-Lock as Esc but also as a Ctrl key (useful for > > Ctrl-f, etc.). > > > The only downside I've noticed so far is that Caps-Lock feels somewhat > > sluggish as Esc, since the Esc event is sent when you release > > Caps-Lock. If this bothers anybody I've added an option to send the > > Esc event on key down but that will effectively disable the chosen > > modifier key. However, it only turns the _left_ modifier key into > > Esc. So, it is possible to e.g. remap Caps-Lock to Alt and then use > > the _right_ Alt as a normal Alt key (I have two Alt keys, but only one > > Ctrl on my keyboard, and I rarely use Alt anyway). I'm not sure > > anybody wants to do this...I think I may use it myself if the > > sluggishness bothers me (otherwise I'll stick with Caps-Lock as Ctrl). > > > To use: > > > 1. Apply patch and recompile > > 2. Enter "System Preferences -> Keyboard & Mouse -> Modifier Keys..." > > and remap Caps-Lock to Ctrl > > 3. Open Terminal and type (one line): defaults write org.vim.MacVim > > MMFakeEscModifier 1 > > 4. Start MacVim and use Caps-Lock as Escape/Ctrl! > > > If you want to use another modifier key, or if you want Caps-Lock to > > send Esc on key down, then read the commit message: > > > Modifier key sends Esc > > > Adds possibility to make the left Ctrl, Alt, or Cmd key function as a > > second Esc key. The key will still function as a modifier if held down > > in conjunction with another key. Enable by setting the user default > > "MMFakeEscModifier" to: > > 1 = Left Ctrl > > 2 = Left Alt > > 3 = Left Cmd > > any other number disables this functionality > > > By remapping Caps-Lock to one of the above modifier keys this enables > > the use of Caps-Lock as a second (and easy to reach) Esc key. Caps-Lock > > can be remapped inside "System Preferences -> Keyboard & Mouse -> > > Modifier Keys...". > > > The Esc event is send when the modifier key is released. If the key is > > not released within a predefined timeout, then no Esc event is > > generated. The timeout can be changed by setting the user default > > MMFakeEscTimeout (a float, specifying the timeout in seconds). > > > The fact that the Esc event is sent on release makes it feel somewhat > > sluggish. It is possible to have the event sent when the modifier key > > is pressed by setting the user default "MMFakeEscOnKeyDown" but then the > > left modifier key can only be used as an Esc key. > > > Let me know what you think about the patch. > > > Björn > > > 0001-Modifier-key-sends-Esc.patch > > 11KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_mac" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
