DEV Community

Alex Yaroslavsky
Alex Yaroslavsky

Posted on

Making Home and End keys work on Mac

Fix for most applications

Open a terminal window:

cd ~/Library
mkdir KeyBindings
cd KeyBindings
pico DefaultKeyBinding.dict
Enter fullscreen mode Exit fullscreen mode

Copy the contents of the text below to the file, press Ctrl-X to exit the editor and select Y to save:

{
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:"; 
/* End Button */
"\UF72B" = "moveToEndOfLine:"; 
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; 
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; 
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:"; 
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:"; 
 /* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; 
}
Enter fullscreen mode Exit fullscreen mode

Fix for Terminal

Open terminal and go to preferences. Select the profile you use and go to the keyboard tab. Look for the the entries with actions \033b (home) and \033f (end) and edit them. When you edit them, select key Home or End respectively and modifier none.

Top comments (0)