Hi MacOS scripting whizz kids
Please can you advise if the below 2 sets of code are ok to plug in, to get the "END" and "HOME" keys to work as expected on Big Sur, for off the shelf £15 windows wired keyboards?
-------------------------------------------------------------------------------------
Code set 1: From Apple community
Hopefully I can just plug this in and I'm away.
It has been over 15 years since I've done any unix command line stuff!
Source for this variation:
https://discussions.apple.com/thread/251108215?answerId=252138948022#252138948022
Instructions:
Run this at the command line, perhaps within Terminal or iterm2:
mkdir -p $HOME/Library/KeyBindings
echo
'{
/* 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 */
}'
> $HOME/Library/KeyBindings/DefaultKeyBinding.dict
----------------------------------------------------------------------------------------------------
Code set 2: From Borgar's Wed link above
I'm struggling to use this one, as I've never scripted on a Mac before.
Link to Borgar's help page:
https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x
Instructions:
Home to send you to the start of the line and not to the top of the document, then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}
Hope you can advise
Kind regards
Martin