OSX: It’s Emacsen all the way down

London, 2014-03-22

Coming from a long time Linux/Windows experience, OSX’s keyboard mapping might seem weird and confusing. Main contributor to this is (alt) in a different place and usage of to invoke main keyboard shortcuts (as opposed to the Ctrl key on PCs).

That accidentally frees the Ctrl key from providing the traditional CUA shortcuts for copy/paste/etc. I don’t know who to thank for it, but somebody at Apple made the Ctrl key emulate most common Emacs key bindings for text manipulation. (I suspect it might be there since a long time ago, due to OSX’s and NeXTStep’s UNIX heritage.)

Here’s a quick list of things that I’ve tried in TextEdit but it works in practically every OSX app:

Moving around:

Editing:

The advantage of having those is obvious when you’re an Emacs user. (muscle memory yada yada yada). But if you’re not, you might still want to use them from time to time:

  1. you might be too lazy and refuse to use arrow buttons (or you want to keep your hands in a little more ergonomic position)
  2. some things like killing lines (Ctrl K) or swapping letters (Ctrl T) are not available otherwise. Ctrl T is quite useful for correcting typos. (My hands insist on typing “transfrom” instead of “transform” all the time…)
  3. Home and End have different meaning on a Mac than they have on a PC (scrolling to the begging and end of the document instead of jumping on the current line). Instead of Ctrl A and Ctrl E you can use and or and .

Using those shortcuts makes even more sense if you map your Caps Lock to Ctrl (which is very easy to setup on OSX). As far as I know there’s no system-wide support for vim shortcuts at this time.