Skip to main content
4 of 4
corrected spelling
jaume
  • 15.6k
  • 4
  • 59
  • 74

@Lri's answer is awesome (thank you so much; this was driving me insane), but I ended up modifying it a little.

(In this answer, I use the non-Apple names for keys, so Command = Super and Option = Alt)

SuperLeft and SuperRight used to actually be mapped to moveToLeftEndOfLine and moveToRightEndOfLine. Using moveToBeginningOfLine and moveToEndOfLine, like @Lri does, may cause inconsistent behaviour.

There are whole bunch of other differences between the Apple shortcuts and literally everybody else's shortcuts that I added. For example, ControlLeft and ControlRight are supposed to move between words; not AltLeft and AltLeft. I don't think this is exhaustive, but it's working pretty well for me right now. I assumed the user has already swapped the Control and Super keys to fix cutting, copying, and pasting.

~/Library/KeyBindings/DefaultKeyBinding.dict:
{
    "\UF729"   = moveToLeftEndOfLine:; // home
    "\UF72B"   = moveToRightEndOfLine:; // end
    "$\UF729"  = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B"  = moveToEndOfLineAndModifySelection:; // shift-end

    "@\UF700"  = moveUp:;  //super-up
    "@\UF701"  = moveDown:;  //super-down
    "@\UF702"  = moveWordLeft:;  //super-left
    "@\UF703"  = moveWordRight:;  //super-right

    "@$\UF700" = moveUpAndModifySelection:;  // super-shift-up
    "@$\UF701" = moveDownAndModifySelection:;  // super-shift-down
    "@$\UF702" = moveWordLeftAndModifySelection:;  // super-shift-left
    "@$\UF703" = moveWordRightAndModifySelection:;  // super-shift-right

    "@\UF728"  = deleteWordForward:;  // super-delete
    "@\U7F"    = deleteWordBackward:;  // super-backspace
}