r8uuga
Last Updated: February 25, 2016
·
974
· jimeh
C48498c82bfaf0c6c8843ba85e3cd598

Emacs-friendly keybindings in Cocoa Apps

Create ~/Library/KeyBindings/DefaultKeyBinding.dict and paste the following in to it:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict */

{
    /* Additional Emacs bindings */
    "~f"    = "moveWordForward:";           /* M-f */
    "~b"    = "moveWordBackward:";          /* M-b */
    "~<"    = "moveToBeginningOfDocument:"; /* M-< */
    "~>"    = "moveToEndOfDocument:";       /* M-> */
    "~v"    = "pageUp:";                    /* M-v */
    "^v"    = "pageDown:";                  /* C-v */
    "~d"    = "deleteWordForward:";         /* M-d */
    "~^h"   = "deleteWordBackward:";        /* M-C-h */
    "~\010" = "deleteWordBackward:";        /* M-backspace */
    "~\177" = "deleteWordBackward:";        /* M-delete */
    "^/"    = "undo:";                      /* C-/ */
    "^?"    = "redo:";                      /* C-? */
    "~c"    = "capitalizeWord:";            /* M-c */
    "~u"    = "uppercaseWord:";             /* M-u */
    "~l"    = "lowercaseWord:";             /* M-l */
    "^t"    = "transpose:";                 /* C-t */
    "~t"    = "transposeWords:";            /* M-t */
    "~/"    = "complete:";                  /* M-/ */
    "^g"    = "_cancelKey:";                /* C-g */
    "^a"    = "moveToBeginningOfLine:";     /* C-a */
    "^e"    = "moveToEndOfLine:";           /* C-e */
    "~w"    = "copy:";                      /* M-w */
    "^w"    = "cut:";                       /* C-w */
    "^y"    = "paste:";                     /* C-y */
}
Say Thanks
Respond
Filed Under