Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created April 13, 2020 11:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
// Emacs keybindings
"^ " = "setMark:";
"~d" = "deleteWordForward:";
"~w" = "copy:"; /* M-w */
"^w" = "deleteWordBackward:";
"^_" = "undo:";
"^?" = "redo:"; /* C-? */
"~f" = "moveWordForward:";
"~b" = "moveWordBackward:";
"~@" = "selectWord:";
"~v" = "pageUp:";
"^g" = "_cancelKey:"; /* C-g */
"^y" = "paste:"; /* C-y */
"^t" = "transpose:"; /* C-t */
"~t" = "transposeWords:"; /* M-t */
"~<" = "moveToBeginningOfDocument:"; /* M-< */
"~>" = "moveToEndOfDocument:"; /* M-> */
"^V" = "pageDownAndModifySelection:";
"~B" = "moveWordBackwardAndModifySelection:";
"~F" = "moveWordForwardAndModifySelection:";
"~/" = "complete:"; /* M-/ */
}

How to setup DefaultKeyBinding for macOS

  1. Run following command
$ mkdir -p ~/Library/KeyBindings/
  1. Create a file named DefaultKeyBinding.dict at location ~/Library/KeyBindings/DefaultKeyBinding.dict with contents from another file in this gist.

  2. If you use iTerm2 on Mac, do following setting so that you can use option key as meta iterm2Settings

  3. Done. Now restart application and you should get Emacs like keybinding to your macOS applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment