It can't be done with :map and friends.
I think there is some kernel hack (well, hey, almost all varieties
of this kind of thing are kernel hacks--some are just dirtier than
others) that can do this...let me spot the link...
OK...I can spot three...
http://www.gnufoo.org/ucontrol/
http://www.kodachi.com/software/fKeys/about.html
http://doublecommand.sourceforge.net/
None look all that promising. :-\ But perhaps getting in touch with the
developers of DoubleCommand, which seems to be the only one still being
developed, might yield some results. It doesn't address your particular
request, but perhaps they can easily add it. Please do post back here if
you discover anything!
Ben.
>
> Geez, bummer. So everyone using vim on a mac is either stretching to
> the esc key or is doing a chord to switch modes? I must say, I'm
> pretty disappointed.
This is the week-end. troll mode is off on week-ends. Come back on
Monday.
Thanks !
David
I think most people are. I don't find escape hard to get to. I do find
Ctrl hard to get to (well, more the contortions needed to use it in
combination with other keys), so have Caps Lock mapped to that.
> I must say, I'm pretty disappointed.
It is a little bit of a shame.
There are other alternatives out there, though. Here are some I've
heard:
- Map <Tab> or ` to <Esc>. A little closer than the <Esc> key. Though
losing <Tab> would be disastrous for me!
- Map <F1> and other nearby keys to <Esc> so you only have to jab vaguely
in the right direction and you'll get it.
- Use gvim in X11 where remapping stuff is possible, I believe. (I don't
think many do this, though.)
- Map jj or ,, to <Esc> in insert mode, since these don't occur in
ordinary text. I think I'd probably find jk easier, and I can't think
of any text *I* write where that occurs... Still, so far, I'm happy
with <Esc>!
Maybe you'd be interested to try one of those approaches. It's different
to what you were hoping, but may turn out just as good.
Ben.
There is this utility:
http://www.pqrs.org/tekezo/macosx/keyremap4macbook/
Takezo is more then willing to add any required feature.
Cheers,
Nikola
>
> Timothy Grant wrote:
>> On Fri, Jun 13, 2008 at 6:27 PM, tom <macw...@gmail.com
>> <mailto:macw...@gmail.com>> wrote:
>>
>>
>> I'm using Leopard + MacVim, and I'm really accustomed to using
>> caps-
>> lock as escape (in Linux). Is there some way to pull this off
>> using
>> the map or map! command? I see it used for tons of other stuff,
>> but
>> not this, unfortunately. Is this doable? I've seen the macosxhints
>> article on this, but I'd really like to avoid Keyboard Maestro,
>> since
>> this computer is temporary and I don't want to pay the shareware
>> fee.
>> Is there a way to do this? If it's only remapped in vim, then I'm
>> happy.
>
> http://doublecommand.sourceforge.net/
>
> None look all that promising. :-\ But perhaps getting in touch with
> the
> developers of DoubleCommand, which seems to be the only one still
> being
> developed, might yield some results. It doesn't address your
> particular
> request, but perhaps they can easily add it. Please do post back
> here if
> you discover anything!
I dowloaded the source for double command (1.6.6b4) and added a #define
ESC_KEY 53 in Common.h, and used that instead of DELETE in
Substitute.cpp (line 925). This is very ugly since this is activated by
'Caps lock key acts as delete key' line in the pref pane, but go me a
working .kext in 5 minutes. So it's very easy to do :)
You probably want to mail the Doublecommand people, they would probably
do it -but cleanly- in 5 minutes as well. ;)
David
However, because it is a hotkey scripting language, you have to imagine
that something is possible. For example, the
Send / SendRaw / SendInput / SendPlay
set of commands "Sends simulated keystrokes and mouse clicks to the
active window."
--Ted
--
Ted Pavlic <t...@tedpavlic.com>
Can you explain how?
I can find ways to remap Function, Shift, and Tab, but not to remap
Caps Lock. Have you remapped your caps lock to escape? Or are you
talking about one of the other keys?
Thanks --
Ted
(note: one day, I remapped caps lock to control through some other
mechanism, but I forgot how... I'm sure it involved modifying some pref
somewhere)
--
Ted Pavlic <t...@tedpavlic.com>
The Google search that led me there was highly Mac biased. However, for
some reason this link came up. AutoHotkey is a Windows app. :(
Sorry. :(
--Ted
Select "System Preferences", "Keyboard & Mouse", "Keyboard" tab, and click "Modifier Keys..." at the bottom-right. In this window you can map <Ctrl>, <CapsLock>, <Option>, and <Command> to each other (or a NOOP).
The trick is to go into System Preferences -> Keyboard and Mouse ->
Keyboard (tab) -> Modifiers Keys... (button). Then change the "Caps
Lock" drop down menu to read "^ Control" and then go into the
PCKeyboardHack pref and remap Caps Lock to keycode 53 (Escape).
There, no more Caps Lock lighting up (and before I did this Caps Lock
presses sometimes used to fail to register).
Björn