top | item 5464386

Remapping Caps Lock on OS X Mountain Lion

14 points| p_almer | 13 years ago |palmer.im | reply

15 comments

order
[+] marvwhere|13 years ago|reply
Not a bad idea to use caps lock for a different key, but i guess it is not the big time saver to use it as cmd+r - takes pretty much the same time.

i also needed a tool to remap some keys - i'm living in germany but i'm using a us-int. keyboard to have it easier on coding. but also i wanted to use german letters: äöü without holding aou pressed and then press the number i need in the overlay of special chars.

now i have it on alt+a/o/u

i used Ukelele (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&...) for it - pretty easy tool, where you can create your complete own keyboard layout and set it up with your own icon and so on. And without less steps then explained in your todo list.

who might is interested in this us-german-layout (https://github.com/marvwhere/usgerman)

[+] alex_h|13 years ago|reply
Remapping Caps Lock to Control is a worthwhile alternative for heavy bash/vim users. Makes shortcuts lie Ctrl-D a lot more natural to type. Besides, it's super simple to do in OSX settings.
[+] ultimoo|13 years ago|reply
Not only vim but also emacs. In fact, OS X affords an emacs readline-like capability throughout all text fields (just like bash). So you can use C-d to delete characters, C-e to go to the end of line, C-a to go to the beginning of a line, and a ton of other shortcuts mapped to Ctrl.
[+] goldfeld|13 years ago|reply
Is Cmd+R such a hard to reach combination to warrant the precious keyboard real state Caps Lock occupies? Me, I double mine as both Ctrl and Esc by using the excellent xcape https://github.com/alols/xcape on linux, and KeyRemap4MacBook otherwise.

I actually find it more relevant on my mac than on my linux box, since Ctrl on the Mac is in a horrible position, and it opens up a whole world of new easy shortcuts that conflict with little else. Plus Ctrl-C and Ctrl-L (clear) on the terminal.

[+] Keyneston|13 years ago|reply
I use my caps as both ctrl and escape by having it mapped to control. Then if you need escape ctrl+[. It requires one finger from each hand and is very quick to press. Then if I want to page up or down in vim I still have the ctrl button easily reachable for ctrl+d and ctrl+u, etc.
[+] p_almer|13 years ago|reply
Good point, however I honestly hit cmd+r more often than I hit Ctrl + anything. Whenever I do hit Control (such as in terminal for ctrl+c as you mentioned) it's much more deliberate and 'one-off'. Different workflows I guess.
[+] daGrevis|13 years ago|reply
This is the thing I was afraid of about OS X. I'm using Arch Linux and I'm in love with Linux per se. I would love to buy Apple computers because of all the great things they offer (I saw it as Linux with complex things somewhere hidden, plus, Windows-like support for apps and games) and I would allow myself to do it because OS X is Unix based and it has decent terminal. This article somehow destroyed my hopes — it's too much to remap a key.
[+] nukerhazz|13 years ago|reply
I agree that Command-R is a silly thing to remap to. Remapping to Control (which can be done through System Preferences) helps not only with bash and vim but with emacs keystrokes which are standard throughout the Cocoa text controls. This is one of the very first things I do when I set up a new Mac.
[+] naftaliharris|13 years ago|reply
My caps-lock gets mapped to escape. On linux, or at least the flavors I'm using, this is super easy: Just drop the following into ~/.Xmodmap

    !! Delete the caps lock key
    clear lock
    !! Make caps lock map to <esc>
    keycode 0x42 = Escape
[+] rammark|13 years ago|reply
Another option is to run setxkbmap after X starts (using a ~/.xinitrc file or your favorite desktop environment's autorun feature.

  'setxkbmap -option caps:esc'

  'setxkbmap -option ctrl:nocaps' (my preference)

  'setxkbmap -option ctrl:swapcaps'
Debian (and derivatives) users can edit the last line in the /etc/default/keyboard file to do this globally.
[+] sksksk|13 years ago|reply
A cool thing that PCKeyboardHack can do is have key remapping only apply when you're in a certain app. So, for example, I have Caps Lock mapped to <C-a> but only when I'm in iTerm2 (for switching between windows in screen)
[+] allerratio|13 years ago|reply
I have it remapped to backspace (colemak layout). The problem I had under OS X was that key repeat didn't work. Additionally setting Capslock in the OS X settings to control solved that problem.
[+] tomwilson|13 years ago|reply
I have mine mapped to escape, for vim.