Skip to content

Instantly share code, notes, and snippets.

@zsimic
Last active July 17, 2024 17:40
Show Gist options
  • Save zsimic/1367779 to your computer and use it in GitHub Desktop.
Save zsimic/1367779 to your computer and use it in GitHub Desktop.
OSX key bindings
{
/* ~/Library/KeyBindings/DefaultKeyBinding.dict
See https://gist.github.com/zsimic/1367779, prefix cheatsheet:
Char Short Key
$ S- Shift ⇧
^ C- CTRL ⌃
~ O- Option ⌥ (⊞ Win key position on PC)
@ M- Command ⌘ (Alt position on PC)
# Numeric Keypad
*/
/*---- Navigation ----*/
/* Up/down is mostly for a nicer laptop navigation (no Home, PgUp etc keys) */
"~\Uf700" = "pageUp:"; /* O-up Page up */
"~$\Uf700" = "pageUpAndModifySelection:"; /* O-S-up Select + page up */
"@\Uf700" = "moveToBeginningOfDocument:"; /* M-up Beginning of document */
"@$\Uf700" = "moveToBeginningOfDocumentAndModifySelection:"; /* M-S-up Select to beginning of document */
"~\Uf701" = "pageDown:"; /* O-down Page down */
"~$\Uf701" = "pageDownpAndModifySelection:"; /* O-S-down Select + page down */
"@\Uf701" = "moveToEndOfDocument:"; /* M-down End of document */
"@$\Uf701" = "moveToEndOfDocumentAndModifySelection:"; /* M-S-down Select to end of document */
/* Windows defaults are more convenient */
"^\Uf702" = "moveWordBackward:"; /* C-left Move word left */
"^$\Uf702" = "moveWordBackwardAndModifySelection:"; /* C-S-left Select word left */
"^\Uf703" = "moveWordForward:"; /* C-right Move word right */
"^$\Uf703" = "moveWordForwardAndModifySelection:"; /* C-S-right Select word right */
"\Uf729" = "moveToBeginningOfLine:"; /* home Beginning of line */
"$\Uf729" = "moveToBeginningOfLineAndModifySelection:"; /* S-home Select to beginning of line */
"^\Uf729" = "moveToBeginningOfDocument:"; /* C-home Beginning of document */
"^$\Uf729" = "moveToBeginningOfDocumentAndModifySelection:"; /* C-S-home Select to beginning of document */
"\Uf72b" = "moveToEndOfLine:"; /* end End of line */
"$\Uf72b" = "moveToEndOfLineAndModifySelection:"; /* S-end Select to end of line */
"^\Uf72b" = "moveToEndOfDocument:"; /* C-end End of document */
"^$\Uf72b" = "moveToEndOfDocumentAndModifySelection:"; /* C-S-end Select to end of document */
"\Uf72c" = "pageUp:"; /* PageUp Page up */
"$\Uf72c" = "pageUpAndModifySelection:"; /* S-PageUp Select + page up */
"@\Uf72c" = "scrollPageUp:"; /* M-PageUp Scroll page up */
"\Uf72d" = "pageDown:"; /* PageDn Page down */
"$\Uf72d" = "pageDownAndModifySelection:"; /* S-PageDn Select + page down */
"@\Uf72d" = "scrollPageDown:"; /* M-PageDn Scroll page down */
/*---- Editing ----*/
"^\U007f" = "deleteWordBackward:"; /* C-Del Delete word backward */
"^\Uf728" = "deleteWordForward:"; /* C-FwdDel Delete word forward */
"$\U000a" = "insertLineBreak:"; /* S-Ret Line break */
}
@zsimic
Copy link
Author

zsimic commented Dec 13, 2020

Other useful links:

Most of the keybindings for editing text in OS X are defined in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict.
You can add custom keybindings by saving a property list like the one below as ~/Library/KeyBindings/DefaultKeyBinding.dict.
Quit and reopen applications to apply changes to DefaultKeyBinding.dict.


(Below was alvaged from an old version of http://osxnotes.net/keybindings.html)

Shortcut strings

\t tab
\n enter
\r return
\U001b escape
\U007f delete
\Uf700 up
\Uf701 down
\Uf702 left
\Uf703 right
\Uf704 F1
\Uf705 F2
\Uf706 F3
\Uf707 F4
\Uf708 F5
\Uf709 F6
\Uf70a F7
\Uf70b F8
\Uf70c F9
\Uf70d F10
\Uf70e F11
\Uf70f F12
\Uf710 F13
\Uf711 F14
\Uf712 F15
\Uf713 F16
\Uf714 F17
\Uf715 F18
\Uf716 F19
\Uf717 F20
\Uf728 forward delete
\Uf729 home
\Uf72b end
\Uf72c page up
\Uf72d page down
\Uf739 clear

^ control
~ option
$ shift
@ command
# numpad

The code points starting from f700 are listed in http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CORPCHAR.TXT

In other contexts like NSUserEquivalents dictionaries, delete is \U0008 (\b) and forward delete is \U007f.

Use escape sequences like  in XML property lists.

NSResponder

capitalizeWord:
centerSelectionInVisibleArea:
deleteBackward:
deleteBackwardByDecomposingPreviousCharacter:
deleteForward:
deleteToBeginningOfLine:
deleteToBeginningOfParagraph:
deleteToEndOfLine:
deleteToEndOfParagraph:
deleteToMark:
deleteWordBackward:
deleteWordForward:
insertBacktab:
insertDoubleQuoteIgnoringSubstitution:
insertNewline:
insertNewlineIgnoringFieldEditor:
insertSingleQuoteIgnoringSubstitution:
insertTab:
insertTabIgnoringFieldEditor:
insertText:
lowercaseWord:
moveBackward:
moveBackwardAndModifySelection:
moveDown:
moveDownAndModifySelection:
moveForward:
moveForwardAndModifySelection:
moveLeft:
moveLeftAndModifySelection:
moveParagraphBackwardAndModifySelection:
moveParagraphForwardAndModifySelection:
moveRight:
moveRightAndModifySelection:
moveToBeginningOfDocument:
moveToBeginningOfDocumentAndModifySelection:
moveToBeginningOfLine:
moveToBeginningOfLineAndModifySelection:
moveToBeginningOfParagraph:
moveToBeginningOfParagraphAndModifySelection:
moveToEndOfDocument:
moveToEndOfDocumentAndModifySelection:
moveToEndOfLine:
moveToEndOfLineAndModifySelection:
moveToEndOfParagraph:
moveToEndOfParagraphAndModifySelection:
moveToLeftEndOfLine:
moveToLeftEndOfLineAndModifySelection:
moveToRightEndOfLine:
moveToRightEndOfLineAndModifySelection:
moveUp:
moveUpAndModifySelection:
moveWordBackward:
moveWordBackwardAndModifySelection:
moveWordForward:
moveWordForwardAndModifySelection:
moveWordLeft:
moveWordLeftAndModifySelection:
moveWordRight:
moveWordRightAndModifySelection:
pageDown:
pageDownAndModifySelection:
pageUp:
pageUpAndModifySelection:
scrollLineDown:
scrollLineUp:
scrollPageDown:
scrollPageUp:
scrollToBeginningOfDocument:
scrollToEndOfDocument:
selectAll:
selectLine:
selectParagraph:
selectToMark:
selectWord:
setMark:
swapWithMark:
transpose:
uppercaseWord:
yank:

Other classes

copy:
cut:
delete:
paste:
pasteAsPlainText:
redo:
undo:
yankAndSelect:

@zsimic
Copy link
Author

zsimic commented Dec 13, 2020

StandardKeyBinding.dict

See the built-in defaults:

$ plutil -convert xml1 /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict -o -|pl|grep -v noop:|ruby -pe'$_.gsub!(/[^ -~\n]/){"\\U%04x"%$&.ord}'

Example output:

{
    "\U0003" = "insertNewline:";
    "\b" = "deleteBackward:";
    "\t" = "insertTab:";
    "\n" = "insertNewline:";
    "\U000d" = "insertNewline:";
    "\U0019" = "insertBacktab:";
    "\U001b" = "cancelOperation:";
    "$\Uf700" = "moveUpAndModifySelection:";
    "$\Uf701" = "moveDownAndModifySelection:";
    "$\Uf702" = "moveLeftAndModifySelection:";
    "$\Uf703" = "moveRightAndModifySelection:";
    "$\Uf729" = "moveToBeginningOfDocumentAndModifySelection:";
    "$\Uf72b" = "moveToEndOfDocumentAndModifySelection:";
    "$\Uf72c" = "pageUpAndModifySelection:";
    "$\Uf72d" = "pageDownAndModifySelection:";
    "@ " = "cycleToNextInputScript:";
    "@$\Uf700" = "moveToBeginningOfDocumentAndModifySelection:";
    "@$\Uf701" = "moveToEndOfDocumentAndModifySelection:";
    "@$\Uf702" = "moveToLeftEndOfLineAndModifySelection:";
    "@$\Uf703" = "moveToRightEndOfLineAndModifySelection:";
    "@." = "cancelOperation:";
    "@^ " = "togglePlatformInputSystem:";
    "@^\Uf701" = "makeBaseWritingDirectionNatural:";
    "@^\Uf702" = "makeBaseWritingDirectionRightToLeft:";
    "@^\Uf703" = "makeBaseWritingDirectionLeftToRight:";
    "@~ " = "cycleToNextInputKeyboardLayout:";
    "@~^\Uf701" = "makeTextWritingDirectionNatural:";
    "@~^\Uf702" = "makeTextWritingDirectionRightToLeft:";
    "@~^\Uf703" = "makeTextWritingDirectionLeftToRight:";
    "@\U007f" = "deleteToBeginningOfLine:";
    "@\Uf700" = "moveToBeginningOfDocument:";
    "@\Uf701" = "moveToEndOfDocument:";
    "@\Uf702" = "moveToLeftEndOfLine:";
    "@\Uf703" = "moveToRightEndOfLine:";
    "^\U0003" = "insertLineBreak:";
    "^\t" = "selectNextKeyView:";
    "^\n" = "insertLineBreak:";
    "^\U000d" = "insertLineBreak:";
    "^\U0019" = "selectPreviousKeyView:";
    "^\"" = "insertDoubleQuoteIgnoringSubstitution:";
    "^$\Uf702" = "moveToLeftEndOfLineAndModifySelection:";
    "^$\Uf703" = "moveToRightEndOfLineAndModifySelection:";
    "^'" = "insertSingleQuoteIgnoringSubstitution:";
    "^/" = "insertRightToLeftSlash:";
    "^A" = "moveToBeginningOfParagraphAndModifySelection:";
    "^B" = "moveBackwardAndModifySelection:";
    "^E" = "moveToEndOfParagraphAndModifySelection:";
    "^F" = "moveForwardAndModifySelection:";
    "^N" = "moveDownAndModifySelection:";
    "^P" = "moveUpAndModifySelection:";
    "^V" = "pageDownAndModifySelection:";
    "^a" = "moveToBeginningOfParagraph:";
    "^b" = "moveBackward:";
    "^d" = "deleteForward:";
    "^e" = "moveToEndOfParagraph:";
    "^f" = "moveForward:";
    "^h" = "deleteBackward:";
    "^k" = "deleteToEndOfParagraph:";
    "^l" = "centerSelectionInVisibleArea:";
    "^n" = "moveDown:";
    "^o" =     (
        "insertNewlineIgnoringFieldEditor:",
        "moveBackward:"
    );
    "^p" = "moveUp:";
    "^t" = "transpose:";
    "^v" = "pageDown:";
    "^y" = "yank:";
    "^~\U007f" = "deleteWordBackward:";
    "^\U007f" = "deleteBackwardByDecomposingPreviousCharacter:";
    "^\Uf700" = "scrollPageUp:";
    "^\Uf701" = "scrollPageDown:";
    "^\Uf702" = "moveToLeftEndOfLine:";
    "^\Uf703" = "moveToRightEndOfLine:";
    "~\U0003" = "insertNewlineIgnoringFieldEditor:";
    "~\b" = "deleteWordBackward:";
    "~\t" = "insertTabIgnoringFieldEditor:";
    "~\n" = "insertNewlineIgnoringFieldEditor:";
    "~\U000d" = "insertNewlineIgnoringFieldEditor:";
    "~\U001b" = "complete:";
    "~$\Uf700" = "moveParagraphBackwardAndModifySelection:";
    "~$\Uf701" = "moveParagraphForwardAndModifySelection:";
    "~$\Uf702" = "moveWordLeftAndModifySelection:";
    "~$\Uf703" = "moveWordRightAndModifySelection:";
    "~^B" = "moveWordBackwardAndModifySelection:";
    "~^F" = "moveWordForwardAndModifySelection:";
    "~^b" = "moveWordBackward:";
    "~^f" = "moveWordForward:";
    "~\U007f" = "deleteWordBackward:";
    "~\Uf700" =     (
        "moveBackward:",
        "moveToBeginningOfParagraph:"
    );
    "~\Uf701" =     (
        "moveForward:",
        "moveToEndOfParagraph:"
    );
    "~\Uf702" = "moveWordLeft:";
    "~\Uf703" = "moveWordRight:";
    "~\Uf728" = "deleteWordForward:";
    "~\Uf72c" = "pageUp:";
    "~\Uf72d" = "pageDown:";
    "\U007f" = "deleteBackward:";
    "\Uf700" = "moveUp:";
    "\Uf701" = "moveDown:";
    "\Uf702" = "moveLeft:";
    "\Uf703" = "moveRight:";
    "\Uf708" = "complete:";
    "\Uf728" = "deleteForward:";
    "\Uf729" = "scrollToBeginningOfDocument:";
    "\Uf72b" = "scrollToEndOfDocument:";
    "\Uf72c" = "scrollPageUp:";
    "\Uf72d" = "scrollPageDown:";
    "\Uf739" = "delete:";
}

@zsimic
Copy link
Author

zsimic commented Dec 13, 2020

Example DefaultKeyBinding.dict

{
  "~w" = selectWord:;
  "~j" = (selectWord:, cut:);
  "~g" = (selectWord:, copy:);
  "~h" = (selectWord:, paste:);

  "~l" = selectParagraph:;
  "~z" = (selectParagraph:, deleteBackward:);
  "~x" = (selectParagraph:, cut:);
  "~c" = (selectParagraph:, copy:);

  "~s" = (moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection:);
  "~y" = (moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection:, deleteBackward:);
  "~q" = (moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection:, cut:);
  "~m" = (moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection:, copy:);

  "~a" = (moveToBeginningOfParagraphAndModifySelection:, copy:);
  "~r" = (moveToEndOfParagraphAndModifySelection:, copy:);
  "~t" = (moveToBeginningOfParagraphAndModifySelection:, cut:);
  "~k" = (moveToEndOfParagraphAndModifySelection:, cut:);

  "~v" = (delete:, setMark:, paste:, selectToMark:);

  "~d" = (setMark:, moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection:, delete:, yank:, insertNewlineIgnoringFieldEditor:, yank:, swapWithMark:);

  "~-" = lowercaseWord:;
  "~=" = uppercaseWord:;
  "~." = capitalizeWord:;

  "@\r" = (moveToEndOfParagraph:, insertNewlineIgnoringFieldEditor:, deleteToBeginningOfParagraph:);
  "$\r" = (moveToBeginningOfParagraph:, insertNewlineIgnoringFieldEditor:, moveBackward:);

  "~\Uf700" = (moveUp:, moveUp:, moveUp:, moveUp:, moveUp:, moveUp:, moveUp, moveUp);
  "~\Uf701" = (moveDown:, moveDown:, moveDown:, moveDown:, moveDown:, moveDown:, moveDown, moveDown);
  "~$\Uf700" = (moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection:, moveUpAndModifySelection, moveUpAndModifySelection);
  "~$\Uf701" = (moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection:, moveDownAndModifySelection, moveDownAndModifySelection);

  "^~\Uf700" = (selectParagraph:, setMark:, deleteToMark:, moveBackward:, moveToBeginningOfParagraph:, setMark:, yank:, moveBackward:, selectToMark:);
  "^~\Uf701" = (selectParagraph:, setMark:, deleteToMark:, moveToEndOfParagraph:, moveForward:, setMark:, yank:, moveBackward:, selectToMark:);

  "@\Uf728" = deleteToEndOfParagraph:;

  "^," = moveToBeginningOfDocument:;
  "^." = moveToEndOfDocument:;
  "^$," = moveToBeginningOfDocumentAndModifySelection:;
  "^$." = moveToEndOfDocumentAndModifySelection:;
  "^~," = (moveToBeginningOfDocumentAndModifySelection:, deleteBackward);
  "^~." = (moveToEndOfDocumentAndModifySelection:, deleteBackward);
  "^d" = deleteToBeginningOfParagraph:;
}

Notes

Key combinations that enter dead key states cannot be reassigned.
They include option-E, option-I, option-N, option-U, and option-` in the U.S. keyboard layout.

setMark:, selectToMark: removes anchoring so that the methods that modify a selection expand the selection.

delete: (bound to the clear key) doesn't delete anything if there is no selection.
deleteBackward: (bound to the delete key) doesn't add deleted selections to the kill ring.
deleteBackward: doesn't add single character selections to the kill ring but setMark:, deleteToMark: does.

scrollPageDown: (bound to page down) doesn't move the caret but pageDown: (bound to option-page down) does.
I haven't changed the page down key to pageDown: because pageDown: doesn't do anything in Safari or other web views.

moveToBeginningOfParagraphAndModifySelection:, moveToEndOfParagraphAndModifySelection: or
selectParagraph:, moveForwardAndModifySelection:, moveBackwardAndModifySelection:, moveBackwardAndModifySelection:, moveToEndOfParagraphAndModifySelection:
select a line without a newline.

delete:, setMark:, paste:, selectToMark: pastes text and selects the pasted text.
If you remove the delete: method, the original selection is kept when the original selection is longer than the pasted text.

defaults write -g NSTextKillRingSize -int 100 makes yankPop: cycle through previously killed pieces of text.

Methods

Emacs keybindings

{
  "^ " = setMark:;
  "^/" = undo:;
  "^u" = deleteToBeginningOfParagraph:;
  "^w" = deleteToMark:;
  "^x" = {
    "^x" = swapWithMark:;
    "^m" = selectToMark:;
  };
  "^V" = pageDownAndModifySelection:;
  "~@" = selectWord:;
  "~b" = moveWordBackward:;
  "~c" = (capitalizeWord:, moveForward:, moveForward:);
  "~d" = deleteWordForward:;
  "~f" = moveWordForward:;
  "~l" = (lowercaseWord:, moveForward:, moveForward:);
  "~u" = (uppercaseWord:, moveForward:, moveForward:);
  "~v" = pageUp:;
  "~w" = (deleteToMark:, setMark:, yank:, swapWithMark:);
  "~B" = moveWordBackwardAndModifySelection:;
  "~F" = moveWordForwardAndModifySelection:;
  "~V" = pageUpAndModifySelection:;
}

This page includes a few more keybindings, but for example transposeWords: doesn't work in most applications, openDocument: and saveDocument: don't work in applications that use auto-save, and performClose: doesn't work everywhere either.

More links

{
  IBInspector = {
    Actions = (
      "ok:",
      "revert:",
      "touch:"
    );
    Outlets = (
      window
    );
    Super = NSObject;
  };
  NSApplication = {
    Super = NSResponder;
    Outlets = (
      delegate
    );
    Actions = (
        "arrangeInFront:",
        "hide:",
        "hideOtherApplications:",
        "miniaturizeAll:",
        "orderFrontColorPanel:",
        "orderFrontDataLinkPanel:",
        "orderFrontHelpPanel:",
        "orderFrontStandardAboutPanel:",
        "orderFrontStandardInfoPanel:",
        "runPageLayout:",
        "stop:",
        "terminate:",
        "unhide:",
        "unhideAllApplications:"
    );
  };
  NSButton = {
    Super = NSControl;
  };
  NSBrowser =
  {
    Outlets = (
      delegate
    );
    Super = NScontrol;
    Actions = (
        "doClick:",
        "doDoubleClick:"
    );
  };
  NSColorWell = {
    Super = NSControl;
    Actions = (
        "takeColorFrom:"
    );
  };
  NSControl = {
    Actions = (
      "takeDoubleValueFrom:",
      "takeFloatValueFrom:",
      "takeIntValueFrom:",
      "takeObjectValueFrom:",
      "takeStringValueFrom:"
    );
    Outlets = (
      target
    );
    Super = NSView;
  };
  NSDocumentController =
  {
    Super = NSObject;
    Actions = (
      "saveAllDocuments:",
      "openDocument:",
      "newDocument:",
      "clearRecentDocuments:"
    );
  };
  NSDocument =
  {
    Super = NSObject;
    Actions = (
        "runPageLayout:",
        "printDocument:",
        "saveDocument:",
        "saveDocumentAs:",
        "saveDocumentTo:",
        "revertDocumentToSaved:"
    );
  };
  NSDrawer =
  {
    Super = NSResponder;
    Actions = (
        "close:",
        "open:",
        "toggle:"
    );
    Outlets = (
      delegate
    );
  };
  NSFontManager =
  {
    Super = NSResponder;
    Actions = (
        "addFontTrait:",
        "removeFontTrait:",
        "modifyFont:",
        "modifyFontViaPanel:",
        "orderFrontFontPanel:"
    );
  };

  NSHelpManager =
  {
    Super = NSResponder;
    Actions = (
        "showHelp:",
        "activateContextHelpMode:"
    );
  };


  NSMenu = {
    Super = NSObject;
  };
  NSMenuItem = {
    Outlets = (
      target
    );
    Super = NSObject;
  };
  NSPanel = {
    Super = NSWindow;
  };
  NSProgressIndicator = {
    Super = NSObject;
    Actions = (
        "animate:",
        "startAnimation:",
        "stopAnimation:"
    );
  };

  NSSlider = {
    Super = NSControl;
  };

  NSTextField = {
    Outlets = (
      delegate
    );
    Super = NSControl;
  };

  NSResponder = {
    Super = NSObject;
    Actions = (
        "selectAll:",
        "deselectAll:",
        "selectText:"
    );
  };

  NSTabView = {
    Super = NSView;
    Actions = (
        "selectFirstTabViewItem:",
        "selectLastTabViewItem:",
        "selectNextTabViewItem:",
        "selectPreviousTabViewItem:",
        "takeSelectedTabViewItemFromSender:"
    );
    Outlets = (
      delegate
    );
  };

  NSText = {
    Super = NSView;
    Actions = (
        "toggleRuler:",
        "copy:",
        "copyFont:",
        "copyRuler:",
        "cut:",
        "delete:",
        "paste:",
        "pasteFont:",
        "pasteRuler:",
        "selectAll:",
        "changeFont:",
        "alignCenter:",
        "alignLeft:",
        "alignRight:",
        "subscript:",
        "superscript:",
        "underline:",
        "unscript:",
        "checkSpelling:",
        "showGuessPanel:",
        "changeSpelling:",
        "ignoreSpelling:"
    );
    Outlets = (
      delegate
    );
  };

  NSTextView = {
    Super = NSText;
    Actions = (
        "changeColor:",
        "alignJustified:",
        "pasteAsPlainText:",
        "pasteAsRichText:",
        "turnOffKerning:",
        "tightenKerning:",
        "loosenKerning:",
        "useStandardKerning:",
        "turnOffLigatures:",
        "useStandardLigatures:",
        "useAllLigatures:",
        "raiseBaseline:",
        "lowerBaseline:",
        "toggleTraditionalCharacterShape:",
        "toggleContinuousSpellChecking:"
    );
  };

  NSView = {
    Super = NSResponder;
    Actions = (
        "fax:",
        "print:"
    );
  };

  NSWindow = {
    Outlets = (
      delegate
    );
    Super = NSResponder;
    Actions = (
        "performZoom:",
        "zoom:",
        "orderBack:",
        "orderFront:",
        "orderOut:",
        "makeKeyAndOrderFront:",
        "selectNextKeyView:",
        "selectPreviousKeyView:",
        "performClose:",
        "deminiaturize:",
        "miniaturize:",
        "performMiniaturize:",
        "fax:",
        "print:",
        "toggleToolbarShown:",
        "runToolbarCustomizationPalette:"
    );
  };
  NSWindowController = {
    Outlets = (
      document
    );
    Super = NSResponder;
    Actions = (
        "showWindow:"
    );
  };

  FirstResponder = {
    Actions = (
      "activateContextHelpMode:",
      "alignCenter:",
      "alignJustified:",
      "alignLeft:",
      "alignRight:",
      "arrangeInFront:",
      "cancel:",
      "capitalizeWord:",
      "changeColor:",
      "changeFont:",
      "checkSpelling:",
      "close:",
      "complete:",
      "copy:",
      "copyFont:",
      "copyRuler:",
      "cut:",
      "delete:",
      "deleteBackward:",
      "deleteForward:",
      "deleteToBeginningOfLine:",
      "deleteToBeginningOfParagraph:",
      "deleteToEndOfLine:",
      "deleteToEndOfParagraph:",
      "deleteToMark:",
      "deleteWordBackward:",
      "deleteWordForward:",
      "deminiaturize:",
      "deselectAll:",
      "fax:",
      "hide:",
      "hideOtherApplications:",
      "indent:",
      "loosenKerning:",
      "lowerBaseline:",
      "lowercaseWord:",
      "makeKeyAndOrderFront:",
      "miniaturize:",
      "miniaturizeAll:",
      "moveBackward:",
      "moveBackwardAndModifySelection:",
      "moveDown:",
      "moveDownAndModifySelection:",
      "moveForward:",
      "moveForwardAndModifySelection:",
      "moveLeft:",
      "moveRight:",
      "moveToBeginningOfDocument:",
      "moveToBeginningOfLine:",
      "moveToBeginningOfParagraph:",
      "moveToEndOfDocument:",
      "moveToEndOfLine:",
      "moveToEndOfParagraph:",
      "moveUp:",
      "moveUpAndModifySelection:",
      "moveWordBackward:",
      "moveWordBackwardAndModifySelection:",
      "moveWordForward:",
      "moveWordForwardAndModifySelection:",
      "ok:",
      "open:",
      "orderBack:",
      "orderFront:",
      "orderFrontColorPanel:",
      "orderFrontDataLinkPanel:",
      "orderFrontHelpPanel:",
      "orderFrontStandardAboutPanel:",
      "orderFrontStandardInfoPanel:",
      "orderOut:",
      "pageDown:",
      "pageUp:",
      "paste:",
      "pasteAsPlainText:",
      "pasteAsRichText:",
      "pasteFont:",
      "pasteRuler:",
      "performClose:",
      "performMiniaturize:",
      "performZoom:",
      "print:",
      "raiseBaseline:",
      "runPageLayout:",
      "runToolbarCustomizationPalette:",
      "scrollLineDown:",
      "scrollLineUp:",
      "scrollPageDown:",
      "scrollPageUp:",
      "scrollViaScroller:",
      "selectAll:",
      "selectLine:",
      "selectNextKeyView:",
      "selectParagraph:",
      "selectPreviousKeyView:",
      "selectText:",
      "selectText:",
      "selectToMark:",
      "selectWord:",
      "showContextHelp:",
      "showGuessPanel:",
      "showHelp:",
      "showWindow:",
      "stop:",
      "subscript:",
      "superscript:",
      "swapWithMark:",
      "takeDoubleValueFrom:",
      "takeFloatValueFrom:",
      "takeIntValueFrom:",
      "takeObjectValueFrom:",
      "takeStringValueFrom:",
      "terminate:",
      "tightenKerning:",
      "toggle:",
      "toggleContinuousSpellChecking:",
      "toggleRuler:",
      "toggleToolbarShown:",
      "toggleTraditionalCharacterShape:",
      "transpose:",
      "transposeWords:",
      "turnOffKerning:",
      "turnOffLigatures:",
      "underline:",
      "unhide:",
      "unhideAllApplications:",
      "unscript:",
      "uppercaseWord:",
      "useAllLigatures:",
      "useStandardKerning:",
      "useStandardLigatures:",
      "yank:",
      "zoom:",
    );
    Super = NSObject;
  };
}

@TemporaryEfx
Copy link

You've assembled an amazing resource... Thank you!

@cdpark0530
Copy link

This is really helpful. Thank you!

@realtnt
Copy link

realtnt commented Mar 11, 2023

Great resource! Thank you!

Just a note if anyone's faced the same issue. For the following to work I had to disable or change the Mission Control shortcuts for moving spaces left and right.

    /* Windows defaults are more convenient */
    "^\Uf702"   = "moveWordBackward:";                              /* C-left       Move word left */
    "^$\Uf702"  = "moveWordBackwardAndModifySelection:";            /* C-S-left     Select word left */

    "^\Uf703"   = "moveWordForward:";                               /* C-right      Move word right */
    "^$\Uf703"  = "moveWordForwardAndModifySelection:";             /* C-S-right    Select word right */

@verityj
Copy link

verityj commented Jun 14, 2023

Thank you for this, truly helpful. Question, is there a shortcut string that would specifically point to the right option key? Can left and right be differentiated in the key bindings?

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