Hacker News new | comments | show | ask | jobs | submit login
Remapping Caps Lock on OS X Mountain Lion (palmer.im)
14 points by p_almer on Mar 30, 2013 | hide | past | web | favorite | 15 comments

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.

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.

I use a modified US layout on OS X for retaining proper touch typing posture while using emacs: http://cl.ly/image/372T2o2X0T0r

Symmetric Ctrl keys that are easily reachable from home row makes a huge difference. I've moved '\' key to 'Insert' because I never use 'Insert' key (before that I'd configured Right Shift to insert '\' when it is not used as a modifier and insert '|' when I press both Shift keys at once but I couldn't set this up using Xmodmap so I went with a cross platform solution).

Doing this is definitely worth it -- in fact, it's how vi was meant to be used [0].

Also, it's worth noting that on OSX you can do this without any additional software. Just remap it in the keyboard settings.

[0] http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys...

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)

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.

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.

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.

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.

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.

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

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.

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)

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.

I have mine mapped to escape, for vim.

Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact