Skip to content

Instantly share code, notes, and snippets.

@octopitus
Last active July 6, 2020 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save octopitus/dd51e77b66a605061021a6c7076e1b8e to your computer and use it in GitHub Desktop.
Save octopitus/dd51e77b66a605061021a6c7076e1b8e to your computer and use it in GitHub Desktop.
/*
Take and modify from https://gist.github.com/trusktr/1e5e516df4e8032cbc3d
~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. 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.
*/
{
"\UF729" = "moveToBeginningOfParagraph:"; // home
"\UF72B" = "moveToEndOfParagraph:"; // end
"$\UF729" = "moveToBeginningOfParagraphAndModifySelection:"; // shift-home
"$\UF72B" = "moveToEndOfParagraphAndModifySelection:"; // shift-end
"^\UF729" = "moveToBeginningOfDocument:"; // ctrl-home
"^\UF72B" = "moveToEndOfDocument:"; // ctrl-end
"^\UF702" = "moveWordLeft:"; // ctrl-left
"^\UF703" = "moveWordRight:"; // ctrl-right
"^$\UF702" = "moveWordLeftAndModifySelection:"; // ctrl-shift-left
"^$\UF703" = "moveWordRightAndModifySelection:"; // ctrl-shift-right
"^$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; // ctrl-shift-home
"^$\UF72B" = "moveToEndOfDocumentAndModifySelection:"; // ctrl-shift-end
"^\177" = "deleteWordBackward:"; // ctl-delete
"^\UF728" = "deleteWordForward:"; // ctl-forwardDelete
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment