The Home and End buttons behave differently in Mac and Windows. In Windows the Home button takes you to the start of a line and the End button takes you to the end of a line. Pressing these while holding in Shift allows you to quickly select a line. In Mac the Home and End buttons take you to the start and end of the document as opposed to the line. This can also be used in conjunction with the shift button to select a large portion of a document.
The difference in the behavior of these buttons can be very frustrating especially for developers switching from Windows to Mac. Fortunately Xcode provides an easy way to change the behavior of key presses which can be used to make End and Home behave like your in windows.
Open Xcode’s Preferences.
Select the Key Bindings tab highlighted in red below.
Now select the Text Key Bindings setting also highlighted in red above. The following screen should be shown.
A list of Action’s along with their bound Keys is shown. Scroll down to ‘Move to Beginning of Line’ and double click on the Keys column. Press the Home key to bind that action to the Home key. Underneath this action there is the ‘Move to Beginning of Line Extending Selection’ action, double click the Keys column here as well and bind it to Shift+Home by holding in Shift and then pressing Home. Repeat this process for all the actions underlined in red above. ‘Move to End of Line’ and ‘Move to End of Line Extending Selection’ actions should be bound using the End button instead of Home.
This will change the behavior of End and Home in Xcode but not in any other applications. There are ways to change this behavior more generally. http://lifehacker.com/225873/mac-switchers-tip–remap-the-home-and-end-keys is a guide to doing so, it will however not work in Xcode or custom applications such as firefox.