Modifier key sends Esc
commitb6c06f31be1e8124ed12cc2ff5361752df1e4634
authorBjorn Winckler <bjorn.winckler@gmail.com>
Tue, 30 Sep 2008 20:06:30 +0000 (30 22:06 +0200)
committerBjorn Winckler <bjorn.winckler@gmail.com>
Thu, 2 Oct 2008 19:48:10 +0000 (2 21:48 +0200)
tree63b080d211408fe771f3b923258c2e6ce84bbb7d
parent8540223185a357c833eb7ae09c981eda87314138
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 sent 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.
src/MacVim/MMAppController.m
src/MacVim/MMApplication.h
src/MacVim/MMApplication.m
src/MacVim/Miscellaneous.h
src/MacVim/Miscellaneous.m