Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created April 13, 2020 11:55
Show Gist options
  • Save anildigital/a35e4cc7a4b1c88d84a3769f99a95a8f to your computer and use it in GitHub Desktop.
Save anildigital/a35e4cc7a4b1c88d84a3769f99a95a8f to your computer and use it in GitHub Desktop.

Revisions

  1. anildigital created this gist Apr 13, 2020.
    27 changes: 27 additions & 0 deletions DefaultKeyBinding.dict
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    {
    "\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-/ */
    }
    13 changes: 13 additions & 0 deletions Installation-Steps.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # How to setup DefaultKeyBinding for macOS

    1. Run following command
    ```bash
    $ mkdir -p ~/Library/KeyBindings/
    ```

    2. Create a file named `DefaultKeyBinding.dict` at location `~/Library/KeyBindings/DefaultKeyBinding.dict` with contents from another file in this gist.

    3. If you use iTerm2 on Mac, do following setting so that you can use option key as meta
    ![iterm2Settings](https://i.imgur.com/zHaVVso.png)

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