Skip to content

Instantly share code, notes, and snippets.

@jerturowetz
Created January 14, 2020 14:27
Show Gist options
  • Save jerturowetz/5a8a866432f1821ea38c02f82504529f to your computer and use it in GitHub Desktop.
Save jerturowetz/5a8a866432f1821ea38c02f82504529f to your computer and use it in GitHub Desktop.
Mac OS Keybindings
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X to more
match default home & end key behavior on Windows & Linux systems.
To use Control instead of Command, either swap Control and Command in
Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
~ : Option (Alt)
@ : Command (Apple)
# : Numeric Keypad
Non-Printable Key Codes
Standard
Up Arrow: \UF700 Backspace: \U0008 F1: \UF704
Down Arrow: \UF701 Tab: \U0009 F2: \UF705
Left Arrow: \UF702 Escape: \U001B F3: \UF706
Right Arrow: \UF703 Enter: \U000A ...
Insert: \UF727 Page Up: \UF72C
Delete: \UF728 Page Down: \UF72D
Home: \UF729 Print Screen: \UF72E
End: \UF72B Scroll Lock: \UF72F
Break: \UF732 Pause: \UF730
SysReq: \UF731 Menu: \UF735
Help: \UF746
OS X
delete: \U007F
For a good reference see http://osxnotes.net/keybindings.html.
NOTE: typically the Windows 'Insert' key is mapped to what Macs call 'Help'.
Regular Mac keyboards don't even have the Insert key, but provide 'Fn' instead,
which is completely different.
*/
{
"@\UF72B" = "moveToEndOfDocument:"; /* Cmd + End */
"@$\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Cmd + End */
"@\UF729" = "moveToBeginningOfDocument:"; /* Cmd + Home */
"@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Cmd + Home */
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment