Fix mapping of non-Apple keyboards

remapping the Command and Option key

If you use a non-Apple external USB keyboard you will notice that the Windows key represents the ⌘ Command Key and the Alt key represents the ⌥ Option key. To invert this key mapping, open the System Preferences → Keyboard → Modifier Keys → Unknown external keyboard and make the changes.

Bind Home and End key of external keyboards to usefull actions

Edit the default keybindings file ~/Library/KeyBindings/DefaultKeyBinding.dict (create the directory and / or the file if they're not already there).

    /* Remap Home / End to be correct :-) */
    "\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
    "\UF72B"  = "moveToEndOfLine:";                         /* End          */
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */