mercoledì 24 gennaio 2018

MacOS: remapping 'home' and 'end' keys for moving to beginning and end of line

It is possible to remap the 'Home' and 'End' keyboard buttons to move the cursor to the end/beginning of the current line instead of current document.

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.