Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AphoticD

macrumors 68020
Original poster
Feb 17, 2017
2,283
3,467
In an effort to extend Xcode v2.5 (Tiger) text editing functionality, I stumbled across these lesser-known custom key binding features in OS X...

Emacs Keybindings for Mac OS X​

As many Mac OS X/Emacs users know, OS X has many of the Emacs key bindings defined for the entire system. Thus, bindings like 【Ctrl+f】, 【Ctrl+b】, 【Ctrl+a】, 【Ctrl+e】, 【Ctrl+k】, 【Ctrl+y】, 【Ctrl+p】, 【Ctrl+n】, and a few others work across the whole system.

Less well known is that the Cocoa Text System is customizable and you can add other Emacs bindings to make a comfortable and familiar environment whether you’re in Emacs, Mail, Safari, or whatever. Even better is that Jacob Rus has already compiled the necessary bindings for you so all you need do is download the file and install it in the proper place on your system.

The full explanation is available here but the TL;DR is:

  1. Download the bindings file.
  2. Rename the file to DefaultKeyBinding.dict.
  3. Stash the file into the ~/Library/KeyBindings folder.
There’s lot of information at the site, though, so it’s well worth a look. It has bindings with 【Esc】 rather than 【⌥ Opt】 as the 【Meta】 key, BBEdit key bindings for any heretics reading this, and many other tidbits as well. But if you just want Emacs key bindings where 【⌥ Opt】 is the 【Meta】 key, then just follow the 3 steps above.

Fully detailed here:

Default Bindings Cheat Sheet:

TextExtras InputManager as referenced, via the wayback machine:

I haven’t delved deep yet, but I can see the power of the key bindings for triggering multiple selectors to stack a sequence of text editing methods. I would personally love to see some Sublime Edit and/or JetBrains style text editing features in Tiger :cool:

[And a VIM mode!]
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.