If you’re like me and you don’t like the way the keys on a Mac work but are forced to do so temporarily, here’s a good tip on fixing those darn Home and End keys:
First, pen Terminal as admin user and enter:
$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ nano DefaultKeyBinding.dict
Then, put this in the file, including curly brackets:
{
/* Remap Home / End keys to be correct */
“\UF729” = “moveToBeginningOfLine:”; /* Home */
“\UF72B” = “moveToEndOfLine:”; /* End */
“$\UF729” = “moveToBeginningOfLineAndModifySelection:”; /* Shift + Home */
“$\UF72B” = “moveToEndOfLineAndModifySelection:”; /* Shift + End */
“^\UF729” = “moveToBeginningOfDocument:”; /* Ctrl + Home */
“^\UF72B” = “moveToEndOfDocument:”; /* Ctrl + End */
“$^\UF729” = “moveToBeginningOfDocumentAndModifySelection:”; /* Shift + Ctrl + Home */
“$^\UF72B” = “moveToEndOfDocumentAndModifySelection:”; /* Shift + Ctrl + End */
}
Finally, save and close (Ctrl+O and then Ctrl+X). Restart and you’re ready to work on a Mac.
Source: http://mwholt.blogspot.de/2012/09/fix-home-and-end-keys-on-mac-os-x.html