Thursday, November 1, 2012

Re: Map Command key to Control on OS X

As I've never owned a Mac so I can't give you setup details, but I've
heard that some people are setting their ITerm's Cmd to send Ctrl, and
also about the use of softwares like keyremap4macbook, keymando, etc
which might also help you with that.
-Alexandre

On Wed, Oct 31, 2012 at 2:19 PM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On 31/10/12 16:48, Heldraug wrote:
>>
>> On Tuesday, October 30, 2012 11:29:24 AM UTC-6, Tim Gray wrote:
>>>
>>> On Oct 30, 2012 at 08:10 AM -0700, Heldraug wrote:
>>>
>>>> Here's the deal: I use a lot a Macbook to code, problem is, it only has
>>>
>>>
>>>> a small Control key on the left side, so it's kind of uncomfortable to
>>>
>>>
>>>> use, particularly when using keys that have to be typed with the left
>>>
>>>
>>>> hand. There are two Command keys, though. I looked around but I
>>>
>>>
>>>> couldn't find an answer to this. Is there a way to map the Command key
>>>
>>>
>>>> to Control, so I can use it as a Control key? Has anyone done this?
>>>
>>>
>>>
>>>
>>> No I haven't done that. However, what I have done is to swap the caps
>>>
>>> lock key and the left control key. You can probably the command key as
>>>
>>> well, but I'm not sure if OS X lets you change just one of the command
>>>
>>> keys and not the other. I use the built in capability on 10.7. It's
>>>
>>> probably available in other versions of OS X, but I can't verify that at
>>>
>>> the moment. Go to System Preferences -> Keyboard, select the Keyboard
>>>
>>> tab and then hit the Modifier Keys... button. There are other apps out
>>>
>>> there that let you remap things in fancier ways, but for simple modifier
>>>
>>> key remapping, this works for me.
>>
>>
>> That works, problem is, it remaps completely the Command key system wide.
>> What I'm looking for is to map the Cmd key only within Vim.
>>
>
> The problem with that is that Cmd and Ctrl are modifier keys, Vim doesn't
> see them separately but only together to whatever letter or function key you
> pressed together with them.
>
> A possible but ugly solution would be
>
> noremap <C-A> <D-A>
> noremap! <C-A> <D-A>
> noremap <D-A> <C-A>
> noremap! <D-A> <C-A>
> noremap <C-B> <D-B>
> noremap! <C-B> <D-B>
> noremap <D-B> <C-B>
> noremap! <D-B> <C-B>
> etc.
>
> There are, however, IIRC, a hundred or so keys on the keyboard. Let's see…
> four statements as above for each of them, plus four other ones to swap
> Ctrl-Alt-<key> with Cmd-Alt-<key>, that's eight, plus eight more to swap
> Ctrl-Shift- and Ctrl-Alt-Shift- with Cmd-Shift- and Cmd-Alt-Shift-… That's
> something like sixteen hundred mappings just for swapping those two keys…
> You could of course define a keymap: see
> http://vim.wikia.com/wiki/How_to_make_a_keymap but keymaps work only in
> Insert and Command-line mones, and is the game worth the candle?
>
> If someone knows an easier way to do it "just for Vim"… or is it possible to
> change the system keyboard preferences just for one application?
>
>
> Best regards,
> Tony.
> --
> "It's Fabulous! We haven't seen anything like it in the last half an
> hour!"
> -- Macy's
>
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment