Monday, December 28, 2015

DefaultKeyBinding.dict (Mac OS X - Home/End keys like a PC)

With my new Mac Mini, took a few lines of editing code to realize how much I use 'Shift+End', 'Shift+Home' and Home, End keys to move around and modify/select code...

Add these snippets to your ~/Library/KeyBindings/DefaultKeyBinding.dict file (may need to create KeyBindings directory)

{
/* remap Home / End */
"\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
"\UF72B"  = "moveToEndOfLine:";                         /* End          */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */

}


(you won't need the open/close braces if modifying an existing dictionary)

source: http://osxnotes.net/keybindings.html

No comments: