Create the file:
~/Library/KeyBindings/DefaultKeyBinding.dict
with the following content:
{   "\UF729"  = moveToBeginningOfLine:; // home    "\UF72B"  = moveToEndOfLine:; // end    "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home    "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end }and restart the system.