March 23, 2020

MacOS Global Emacs Keybindings

To enable Emacs like keybindings globally on the operating system, edit ~/Library/KeyBindings/DefaultKeyBinding.dict to inlcude something like this:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
 
{
    /* Additional Emacs bindings */
    "~f" = "moveWordForward:";
    "~b" = "moveWordBackward:";
    "~<" = "moveToBeginningOfDocument:";
    "~>" = "moveToEndOfDocument:";
    "~v" = "pageUp:";
    "~d" = "deleteWordForward:";
    "~^h" = "deleteWordBackward:";
    "~\010" = "deleteWordBackward:";  /* Option-backspace */
    "~\177" = "deleteWordBackward:";  /* Option-delete */
   
    /* Escape should really be complete: */
    "\033" = "complete:";  /* Escape */
}

Then reboot the system.

src: https://github.com/walter/additional-mac-os-x-emacs-key-bindings/blob/master/DefaultKeyBinding.dict