josverhoeff 6 Newbie Poster

I have been programming on a PC with 101 key keyboard for almost thirty years now. Surprise, when this type of keyboard turned out to be very poorly supported by OSX on a Mac Mini.
as you know, on the mac mini you have to attach your own keyboard. This is fine by me. I have a laptop and a mac mini on a KVA switch so I can use both.

My main problem turned out to be that many of the keyboard habits I developed no longer worked, since they either use the CTRL key (on a PC keyboard this turned out to be the Windows key) or the numeric keypad (to select and to copy-paste)
The windows key and the CTRL key could be easily swapped in the system preferences.

Where I got stuck was with the numeric keypad problem since the mac does not react to NUMLOCK toggle.
Since I googled for a long time and only found pointers to partial solutions, I thought I'd share the solution I came up with eventually:
This solution works for the most part on my mac mini with OSX Yoshemite. Reportedly it works only in modern apps. It does work in Xcode, except one key combination.

  1. Locate or create ~/Library/KeyBindings/DefaultKeyBinding.Dict (the users library) If you need to create it, make sure it's in unicode. Also, if you use Mac Write to edit, turn off automatic quote swapping.

  2. Add the following lines, if the file existed already, leave out the curly brackets of course:

    "#1" = "moveToEndOfLine:"; /* simulate NUMLOCK OFF /
    "$#1" = "moveToEndOfLineAndModifySelection:";
    "#2" = "moveDown:";
    "$#2" = "moveDownAndModifySelection:";
    "#3" = "pageDown:";
    "$#3" = "pageDownAndModifySelection:";
    "#4" = "moveBackward:";
    "$#4" = "moveBackwardAndModifySelection:";
    "#5" = ":";
    "$#5" = ":";
    "#6" = "moveForward:";
    "$#6" = "moveForwardAndModifySelection:";
    "#7" = "moveToBeginningOfLine:";
    "$#7" = "moveToBeginningOfLineAndModifySelection:";
    "#8" = "moveUp:";
    "$#8" = "moveUpAndModifySelection:";
    "#9" = "pageUp:";
    "$#9" = "pageUpAndModifySelection:";
    "#0" = ":"; /
    do nothing /
    "@#0" = "copy:"; /
    old windows CTRL-INSERT /
    "$#0" = "paste:"; /
    old windows SHIFT-INSERT */
    "#." = "deleteForward:";

Log off and on again and all numeric keypad keys now work as if NumLock is OFF

The @#0 and $#0 (CTRL-INS and SHIFT-INS on the numeric keypad, copy and paste) are really old windows shortcuts which do work in windows. The supplied code should thearetically work, but somehow in Xcode anothet action takes precedence.

For completeness, here's the comment of a sample file I found, to explain the different options:

   /* ~/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.