Skip to content

Instantly share code, notes, and snippets.

@kflu
Last active October 17, 2018 23:58
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 kflu/8e54318477393bcb531cdfdc44b65b9e to your computer and use it in GitHub Desktop.
Save kflu/8e54318477393bcb531cdfdc44b65b9e to your computer and use it in GitHub Desktop.
DefaultKeyBinding.Dict
/* ~/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 particular mapping assumes
that you have also switched the Control and Command keys already.
This key mapping is more appropriate after switching Ctrl for Command in this menu:
Apple->System Preferences->Keyboard & Mouse->Keyboard->Modifier Keys...->
Change Control Key to Command
Change Command key to Control
This applies to OS X 10.5 and possibly other versions.
Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
~ : Option (Alt)
@ : Command (Apple)
# : Numeric Keypad
Non-Printable Key Codes
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
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.
CURRENT ISSUES:
- Shift-ins doesn't work
- Should not remap c-a, because laptop keyboard doesn't have home key
to go to line beginning
- c-c, c-v still doesn't work in gist.github text field.
*/
{
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"^$\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"^$\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
"\UF72C" = "pageUp:"; /* PageUp */
"\UF72D" = "pageDown:"; /* PageDown */
"$\UF728" = "cut:"; /* Shift + Del */
"^x" = "cut:"; /* Ctrl + X */
"^\UF727" = "copy:"; /* Ctrl + Ins */
"^\UF746" = "copy:"; /* Ctrl + Help (Ins) */
"^c" = "copy:"; /* Ctrl + Help (Ins) */
"$\UF746" = "paste:"; /* Shift + Help */
"$\UF727" = "paste:"; /* Shift + Ins (not working) */
"^v" = "paste:"; /* Shift + Ins */
/* Need to remap mission control "Space" for below 2 lines to work
"^\UF702" = "moveWordBackward:"; /* Ctrl + LeftArrow */
"^\UF703" = "moveWordForward:"; /* Ctrl + RightArrow */
"^$\UF702" = "moveWordBackwardAndModifySelection:"; /* Shift + Ctrl + Leftarrow */
"^$\UF703" = "moveWordForwardAndModifySelection:"; /* Shift + Ctrl + Rightarrow */
"^\U0008" = "deleteWordBackward:"; /* Ctrl + Backspace */
"^\UF728" = "deleteWordForward:"; /* Ctrl + Delete */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment