2

I am new to macOS and a big fan of Emacs. I am trying to achieve Emacs keybindings everywhere.

Despite the fact that I have read multiple times on the web people stating that macOS was friendly and out of the box with Emacs keybindings, I am having some hassles. Obviously, the problems happen outside of Emacs. In Emacs, things work as expected.

I am struggling with copy, paste, cut, for instance. But I also used to have problems with those in Linux (Ubuntu/NixOs).

Unlike in macOS, in Linux I managed to get M-b (move back word) and M-f (move forward) to work.

It is possible to do it with Command-M-b and Command-M-f but I do not want to change my habbit/muscle memory. I want to make this new computer adapt to me - not the opposite.

Some old posts (like #1, #2, #3, #4) mention a tweak on ~/Library/KeyBindings/. By the way, a lot of posts are mentioning Jacob Rus' comprehensive guide which is hosted on Harvard University domain.... But the link is broken.

Unfortunately, I cannot even find this folder:

Pedros-MacBook-Air:Library pedro$ pwd
/Users/pedro/Library
Pedros-MacBook-Air:Library pedro$ cd Key
Keyboard/         Keyboard Layouts/ KeyboardServices/ Keychains/ 

How to find ~/Library/KeyBindings/ in Mac M1 Monterey 12.5? Should I create it?

Also, others posting more recent content are suggesting other alternatives, such as Karabiner-elements (#1 #2). Karabiner-elements can also be useful for short keys to launch applications.

What is the best technical practice to change keybindings in macOS? What are the technical arguments around every solution?

2 Answers 2

3

After some research and trial/error, I have become a heavy user of Karabiner Elements.

This software is really well-crafted. I have been having a great Emacs UX out of Emacs and inside a macOS thanks to Karabiner Elements.

I have even created a GitHub repo to share my configuration for Karabiner

I do not have the technical expertise to discuss and contrast the positive/negative aspects of each alternative. What I can state is that Karabiner-elements really improved my life.

2

As for getting your mac adapting to you and your Emacs muscle memory without third-party apps, my option has been, since 2010, to add a DefaultKeyBinding.dict inside my ~/Library/KeyBindings/.

And yes, I did have to make the KeyBindings directory inside ~/Library/ and move my keybindings file into it. (I don't have an M1 Mac, so I can't test it, but I don't see why that would be difficult to achieve. I have an Intel-based 2019 MacBookAir running Monterey 12.6).

I've tweaked (in Emacs, of course) Jacob Rus' DefaultKeyBinding.dict several times since I first copied it in 2010. You can find my version in https://github.com/plgx/DefaultKeybindings.dict/tree/main

You can also adapt it to your needs using for reference Apple's Cocoa Event Handling Guide.

(BTW, I'm sure Karabiner Elements is a great piece of software. I'll give it a try soon.)

1
  • 1
    Interesting addition. I am glad you are putting it on GitHub. I believe there is a gap on this type of content. Oct 11, 2022 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .