CMD+Left Arrow, CMD+Right Arrow — Jump Word

keybindingskeyboard

I've switched my Ctrl and Cmd key to replicate my hotkeys on Windows. I've fixed my home and end keys to behave as I'd like and now all that's left is remapping my Cmd+ and Cmd+ to behave properly.

So far – tried a bunch of things suggested on StackOverflow and really can't get it to work. I've tried:

  • Possible to move the cursor word-by-word with Cmd+left/right instead of Alt+left/right? (accepted answer and KeyBindingsEditor program).
  • The following in my ~/Library/KeyBindings/DefaultKeyBinding.dict (from http://heisencoder.net/2008/04/fixing-up-mac-key-bindings-for-windows.html):

    {
    "\UF729"   = "moveToBeginningOfLine:";                       /* Home         */
    "@\UF729"  = "moveToBeginningOfDocument:";                   /* Cmd  + Home  */
    "$\UF729"  = "moveToBeginningOfLineAndModifySelection:";     /* Shift + Home */
    "@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Cmd  + Home */
    "\UF72B"   = "moveToEndOfLine:";                             /* End          */
    "@\UF72B"  = "moveToEndOfDocument:";                         /* Cmd  + End   */
    "$\UF72B"  = "moveToEndOfLineAndModifySelection:";           /* Shift + End  */
    "@$\UF72B" = "moveToEndOfDocumentAndModifySelection:";       /* Shift + Cmd  + End */
    "\UF72C"   = "pageUp:";                                      /* PageUp       */
    "\UF72D"   = "pageDown:";                                    /* PageDown     */
    "$\UF728"  = "cut:";                                         /* Shift + Del  */
    "$\UF727"  = "paste:";                                       /* Shift + Ins */
    "@\UF727"  = "copy:";                                        /* Cmd  + Ins  */
    "$\UF746"  = "paste:";                                       /* Shift + Help */
    "@\UF746"  = "copy:";                                        /* Cmd  + Help (Ins) */
    "@\UF702"  = "moveWordBackward:";                            /* Cmd  + LeftArrow */
    "@\UF703"  = "moveWordForward:";                             /* Cmd  + RightArrow */
    "@$\UF702" = "moveWordBackwardAndModifySelection:";   /* Shift + Cmd  + Leftarrow */
    "@$\UF703" = "moveWordForwardAndModifySelection:";   /* Shift + Cmd  + Rightarrow */
    }
    

Any ideas why this won't work for me?

Best Answer

I know that you are trying to do this via KeyBindings, but here is an alternative method using Keyboard Maestro:

Keyboard Maestro to remap keys