Using a utility called "KeyBindingsEditor" I created the following table. It shows the contents of the StandardKeyBinding.dict file. You can use that editor to create your own key bindings as well.
/System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict:
Modifiers | Key | Mapped to NSResponder functions |
Esc | cancelOperation: | |
⌘ | . | cancelOperation: |
⌃ | L | centerSelectionInVisibleArea: |
F5 | complete: | |
⌥ | Esc | complete: |
⌘⌥ | Space | cycleToNextInputKeyboardLayout: |
⌘ | Space | cycleToNextInputScript: |
Clear Line | delete: | |
Delete | deleteBackward: | |
Backspace | deleteBackward: | |
⌃ | H | deleteBackward: |
⌃ | Delete | deleteBackwardByDecomposingPreviousCharacter: |
⌃ | D | deleteForward: |
Del | deleteForward: | |
⌘ | Delete | deleteToBeginningOfLine: |
⌃ | K | deleteToEndOfParagraph: |
⌥ | Backspace | deleteWordBackward: |
⌃⌥ | Delete | deleteWordBackward: |
⌥ | Delete | deleteWordBackward: |
⌥ | Del | deleteWordForward: |
BackTab | insertBacktab: | |
⌃ | " | insertDoubleQuoteIgnoringSubstitution: |
⌃ | Linefeed | insertLineBreak: |
⌃ | Return | insertLineBreak: |
⌃ | Enter | insertLineBreak: |
Enter | insertNewline: | |
Linefeed | insertNewline: | |
Return | insertNewline: | |
⌥ | Enter | insertNewlineIgnoringFieldEditor: |
⌥ | Linefeed | insertNewlineIgnoringFieldEditor: |
⌥ | Return | insertNewlineIgnoringFieldEditor: |
⌃ | O | insertNewlineIgnoringFieldEditor: moveBackward: |
⌃ | / | insertRightToLeftSlash: |
⌃ | insertSingleQuoteIgnoringSubstitution: | |
Tab | insertTab: | |
⌥ | Tab | insertTabIgnoringFieldEditor: |
⌘⌃ | Right Arrow | makeBaseWritingDirectionLeftToRight: |
⌘⌃ | Down Arrow | makeBaseWritingDirectionNatural: |
⌘⌃ | Left Arrow | makeBaseWritingDirectionRightToLeft: |
⌘⌥⌃ | Right Arrow | makeTextWritingDirectionLeftToRight: |
⌘⌥⌃ | Down Arrow | makeTextWritingDirectionNatural: |
⌘⌥⌃ | Left Arrow | makeTextWritingDirectionRightToLeft: |
⌃ | B | moveBackward: |
⌥ | Up Arrow | moveBackward: moveToBeginningOfParagraph: |
⇧⌃ | B | moveBackwardAndModifySelection: |
Down Arrow | moveDown: | |
⌃ | N | moveDown: |
⇧ | Down Arrow | moveDownAndModifySelection: |
⇧⌃ | N | moveDownAndModifySelection: |
⌃ | F | moveForward: |
⌥ | Down Arrow | moveForward: moveToEndOfParagraph: |
⇧⌃ | F | moveForwardAndModifySelection: |
Left Arrow | moveLeft: | |
⇧ | Left Arrow | moveLeftAndModifySelection: |
⌥⇧ | Up Arrow | moveParagraphBackwardAndModifySelection: |
⌥⇧ | Down Arrow | moveParagraphForwardAndModifySelection: |
Right Arrow | moveRight: | |
⇧ | Right Arrow | moveRightAndModifySelection: |
⌘ | Up Arrow | moveToBeginningOfDocument: |
⇧ | Home | moveToBeginningOfDocumentAndModifySelection: |
⌘⇧ | Up Arrow | moveToBeginningOfDocumentAndModifySelection: |
⌃ | A | moveToBeginningOfParagraph: |
⇧⌃ | A | moveToBeginningOfParagraphAndModifySelection: |
⌘ | Down Arrow | moveToEndOfDocument: |
⇧ | End | moveToEndOfDocumentAndModifySelection: |
⌘⇧ | Down Arrow | moveToEndOfDocumentAndModifySelection: |
⌃ | E | moveToEndOfParagraph: |
⇧⌃ | E | moveToEndOfParagraphAndModifySelection: |
⌃ | Left Arrow | moveToLeftEndOfLine: |
⌘ | Left Arrow | moveToLeftEndOfLine: |
⌃⇧ | Left Arrow | moveToLeftEndOfLineAndModifySelection: |
⌘⇧ | Left Arrow | moveToLeftEndOfLineAndModifySelection: |
⌃ | Right Arrow | moveToRightEndOfLine: |
⌘ | Right Arrow | moveToRightEndOfLine: |
⌃⇧ | Right Arrow | moveToRightEndOfLineAndModifySelection: |
⌘⇧ | Right Arrow | moveToRightEndOfLineAndModifySelection: |
Up Arrow | moveUp: | |
⌃ | P | moveUp: |
⇧ | Up Arrow | moveUpAndModifySelection: |
⇧⌃ | P | moveUpAndModifySelection: |
⌥⌃ | B | moveWordBackward: |
⇧⌥⌃ | B | moveWordBackwardAndModifySelection: |
⌥⌃ | F | moveWordForward: |
⇧⌥⌃ | F | moveWordForwardAndModifySelection: |
⌥ | Left Arrow | moveWordLeft: |
⌥⇧ | Left Arrow | moveWordLeftAndModifySelection: |
⌥ | Right Arrow | moveWordRight: |
⌥⇧ | Right Arrow | moveWordRightAndModifySelection: |
⌥ | Page Down | pageDown: |
⌃ | V | pageDown: |
⇧⌃ | V | pageDownAndModifySelection: |
⇧ | Page Down | pageDownAndModifySelection: |
⌥ | Page Up | pageUp: |
⇧ | Page Up | pageUpAndModifySelection: |
⌃ | Down Arrow | scrollPageDown: |
Page Down | scrollPageDown: | |
⌃ | Up Arrow | scrollPageUp: |
Page Up | scrollPageUp: | |
Home | scrollToBeginningOfDocument: | |
End | scrollToEndOfDocument: | |
⌃ | Tab | selectNextKeyView: |
⌃ | BackTab | selectPreviousKeyView: |
⌘⌃ | Space | togglePlatformInputSystem: |
⌃ | T | transpose: |
⌃ | Y | yank: |
Just in case, the ^ modifier is the Ctrl key.
As you possibly noticed, this is not limited to the editing commands but it is the complete mapping table.
You can also see that not all NSResponder functions have an associated key mapping. If you implement a function in NSResponder without a mapping, be sure to add a menu item as well so that the user is actually able to use that function! (Or be sure to decompose the key mapping yourself in keyDown)
Note that not all mappings are available on all keyboards!, i.e. keys may be missing on certain types of keyboard. Make sure that the key's for the mappings that you need are indeed available on all the keyboards your application supports.
A source of confusion is the "Delete" key. This is not to be confused with the "Del" key. On some keyboards the "Del" key has the imprint "delete ⌦".
The following table shows which editing related NSResponder functions are not mapped by default:
As you possibly noticed, this is not limited to the editing commands but it is the complete mapping table.
You can also see that not all NSResponder functions have an associated key mapping. If you implement a function in NSResponder without a mapping, be sure to add a menu item as well so that the user is actually able to use that function! (Or be sure to decompose the key mapping yourself in keyDown)
Note that not all mappings are available on all keyboards!, i.e. keys may be missing on certain types of keyboard. Make sure that the key's for the mappings that you need are indeed available on all the keyboards your application supports.
A source of confusion is the "Delete" key. This is not to be confused with the "Del" key. On some keyboards the "Del" key has the imprint "delete ⌦".
The following table shows which editing related NSResponder functions are not mapped by default:
func moveToBeginningOfLine(sender: AnyObject?) |
func moveToEndOfLine(sender: AnyObject?) |
func moveToBeginningOfLineAndModifySelection(sender: AnyObject?) |
func moveToEndOfLineAndModifySelection(sender: AnyObject?) |
func scrollLineUp(sender: AnyObject?) |
func scrollLineDown(sender: AnyObject?) |
func transposeWords(sender: AnyObject?) |
func selectAll(sender: AnyObject?) |
func selectParagraph(sender: AnyObject?) |
func selectLine(sender: AnyObject?) |
func selectWord(sender: AnyObject?) |
func indent(sender: AnyObject?) |
func insertParagraphSeparator(sender: AnyObject?) |
func insertNewlineIgnoringFieldEditor(sender: AnyObject?) |
func insertTabIgnoringFieldEditor(sender: AnyObject?) |
func insertLineBreak(sender: AnyObject?) |
func insertContainerBreak(sender: AnyObject?) |
func changeCaseOfLetter(sender: AnyObject?) |
func uppercaseWord(sender: AnyObject?) |
func lowercaseWord(sender: AnyObject?) |
func capitalizeWord(sender: AnyObject?) |
func deleteToEndOfLine(sender: AnyObject?) |
func deleteToBeginningOfParagraph(sender: AnyObject?) |
func setMark(sender: AnyObject?) |
func deleteToMark(sender: AnyObject?) |
func selectToMark(sender: AnyObject?) |
func swapWithMark(sender: AnyObject?) |
Some of these functions are duplicates of the ones that are mapped. So be sure to implement the right function. For example "moveToEndOfLine:" is not mapped, but "moveRightToEndOfLine:" is. So use the later for this functionality.
Other functions are not mapped in StandardKeyBinding.dict but are "mapped" in a menu item, like "selectAll:".
Still, there may be some functions that are useful to your application (like "transposeWords:" or "capitalizeWord:" etc). The way to use these is to provide menu-items for them, and to include Key Equivalent's for them in those menu items. Even for some less used functions like "transpose:" this may be useful as it shows your user that these relatively unknown functions are in fact available.
Happy coding...
Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH
We don't get the world we wish for... we get the world we pay for.
Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH
We don't get the world we wish for... we get the world we pay for.
No comments:
Post a Comment