560

Most of my computing time is spent in Linux (with occasional time in Windows). On these platforms the Home and End keys universally jump to the beginning or end of the current line.

I am gradually getting used to using the one Apple computer in my life, but it is still frustrating than these keys seem to be bound to the beginning and end of the document and there doesn't seem to be any key at all for the line based actions.

My question:

  1. Are there existing keybindings I'm missing for beginning and end of line? (I mostly use a Terminal, Chrome and LibreOffice)
  2. Is there a way to rebind the functions of these keys to the functions I am familiar with? I am willing to give up the document based versions which seem of little use to me.

Also two caveats:

  1. I am not the only user on the system. It would be nice if my user settings didn't break other peoples experience. If this isn't possible, I think I probably have the strongest preference!
  2. I do use multiple languages and switch between keyboard layouts, so any solutions would be expected to work even when toggling between multiple keyboard layouts.
Caleb
  • 7,093
  • 2
    Note that while I ended up finding a solution and answering my own question, I'm open to easier or more versatile solutions. Also the process of discovering this is not clear. For example where do you find key codes and action names if I wanted to remap more keys? Feel free to add answers if you have relevant knowledge! – Caleb Jun 18 '11 at 09:08
  • 7
    I hate my mac for this exact reason. Every system uses home and end except mac. – barrypicker Jun 26 '21 at 19:53
  • 2
    this has been my biggest bane since using Mac – Eman Jul 15 '21 at 18:07

13 Answers13

504

The default shortcuts for moving to beginning or end of (wrapped) lines are and . and or A and E move to the beginning or end of unwrapped lines (or paragraphs). and move backwards/forward by words, and all of these are compatible with holding Shift to select during the corresponding moves.

You could remap home and end by creating ~/Library/KeyBindings/ and saving a property list like this as DefaultKeyBinding.dict:

{
    "\UF729"  = moveToBeginningOfLine:; // home
    "\UF72B"  = moveToEndOfLine:; // end
    "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
}

Most of the keybindings for editing text in OS X are defined in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict.

Applying changes requires reopening applications. DefaultKeyBinding.dict is ignored by some old versions of Xcode (works with latest version 6.3.1), Terminal, and many cross-platform applications.

See Cocoa Text System for more information about the customizable keybindings.

Terminal's keybindings can be customized in Preferences > Profiles > Settings > Keyboard. \033OH moves to the beginning of a line and \033OF to the end of a line.

In Eclipse, key bindings should be modified in Preferences > General > Keys. You need to modify default bindings for commands Line Start and Line End (replace ⌘← by ↖ and ⌘→ by ↘). For selection to work, also modify Select Line Start and Select Line End.

PS: You may need to logout and login again for the ~/Library/KeyBindings/DefaultKeyBinding.dict change to take effect.

Lri
  • 105,117
  • 3
    Useful info about the key mappings - I've used these with the (commercial) BetterTouchTool, see this answer. – RichVel Sep 19 '17 at 08:43
  • 5
    This doesn't work in most applications in my experience. It is better to use Karabina-Elements. – Timmmm Oct 25 '17 at 08:56
  • 8
    This is great because it works in Terminal, iTerm2, Chrome, Sublime & Outlook. The alternative (Karabina) is less good because that maps "Home" to Command+LeftArrow, which actually switches windows in Terminal. You must remember to restart all apps after saving the .dict file. – Will Sheppard Nov 16 '17 at 15:14
  • 1
    This doesnt work with vim – MohitC Jun 01 '18 at 07:08
  • /StandardKeyBinding.dict is binary. You can't read it – Green Jun 16 '18 at 11:45
  • 1
    Your site link is broken – Green Jun 16 '18 at 11:46
  • @Green for binary plist editing see https://apple.stackexchange.com/questions/101719/trouble-opening-plist-files-in-text-editor/101720#101720 – mmmmmm Sep 09 '18 at 09:05
  • 7
    This setting works for me on Mac OS Mojave with external keyboard connected. – jdhao Oct 14 '18 at 14:56
  • Thanks a lot for this great effort you did there! Thank you. – gia Apr 12 '19 at 11:26
  • 1
    Thank you so much! Report: Outlook, Word, Terminal and Slack Snippet worked immediately. MacOS Notes and Chrome worked after application restart. Slack Add Message doesn't honor this. Webstorm always worked. – Turbo Jun 24 '19 at 19:47
  • OMG than you so much. Thank you comments are noise but thank you. New to AppleMac for 3 months and as a dev who uses keyboard shortcuts all the time, I've been shouting at my screen at various points of the day. This has made life normal again! – James Oct 16 '19 at 18:51
  • 2
    This does no longer work for Safari (and many other programs) in Catalina. – Adam Lindberg Jun 11 '20 at 13:48
  • 10
    Unfortunately my Home and End keys still don't behave properly in Slack, which is driving me nuts. But generally this tip is helpful. Many other articles (including https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x) mention ctrl-shift-home and ctrl-shift-end, but I've never seen those work, regardless of app. – Ryan Jan 07 '21 at 14:54
  • no longer works in pages – ina Oct 25 '21 at 01:59
  • Worked on BigSur for Chrome. – Mark Apr 08 '22 at 09:58
  • Terminal's keybindings seems not to work in Monterey – Teejay May 31 '22 at 01:15
  • 1
    @Ryan have you ever found a solution to the Slack issue? It's driving me nuts too. – Alex Friedman Dec 13 '22 at 11:02
  • 1
    @AlexFriedman Nope, and I've talked with Slack support about it, and they don't care. – Ryan Dec 13 '22 at 14:43
  • Thank you so much! I can finally use Xcode in Ventura without pulling my hair out. Just had to log out and back in after making the file. I found it easier to run these in the terminal so I could paste the text into TextEdit: sudo mkdir ~/Library/KeyBindings sudo chown $(whoami):staff ~/Library/KeyBindings touch ~/Library/KeyBindings/DefaultKeyBinding.dict open -a TextEdit ~/Library/KeyBindings/DefaultKeyBinding.dict – theSparky Aug 11 '23 at 19:53
  • This has fixed most my apps (Slack, iterm2, etc), but unfortunately it's not working on Firefox. I'm on sonoma though. – morhook Jan 08 '24 at 15:23
  • My StandardKeyBinding.dict (Sonoma 14.1.1) has moveToLeftEndOfLine and moveToRightEndOfLine instead of Beginning and End, but I'm not sure when that changed:
        "\UF729"  = moveToLeftEndOfLine:; // home
        "\UF72B"  = moveToRightEndOfLine:; // end
        "$\UF729" = moveToLeftEndOfLineAndModifySelection:; // shift-home
        "$\UF72B" = moveToRightEndOfLineAndModifySelection:; // shift-end
    }```
    
    Also, terminal has it's own keybindings settings:
    Home -> Ctrl+a (rendered: `↖: \001`)
    End -> Ctrl+e (rendered: `↘: \005`)
    
    This was great, thanks!
    
    – Julian de Bhal Mar 21 '24 at 23:55
155

I'm currently on Lion 10.7.4, and for some strange reason editing the ~/Library/KeyBindings/DefaultKeyBinding.dict didn't work for me.

I have found that the KeyRemap4MacBook System Preferences addon (which is now called Karabiner-Elements) works really well, and you can also re-map a variety of keys with it, without having to edit any text files. E.g. changing the page up / page down keys so the cursor also follows on page up / down.

Just download the addon, and in the System Preferences panel, browse to the For PC Users section, and check Use PC Style Home /End.

Note, I picked (Change Home to Command+Left) instead of (Change Home to Control+A), as if I picked the first, and if the line was wrapped, home would take me to the beginning of the wrapped line, several lines above, instead of taking me to the beginning of the current line.

KeyRemap4MacBook

drmuelr
  • 103
  • 3
jklp
  • 1,762
  • 13
    Karabiner is great and also open source – Jedidja Feb 04 '15 at 17:14
  • 2
    With 10.10.5, the other suggestions seem to not work, but Karabiner (the new name for KeyRemap4MacBook -- works on all the Mac products) works well, and doesn't need a restart for the changes to take effect. Immensely helpful for this Mac noob; hopefully others can benefit as well. – Ralph J Nov 10 '15 at 15:36
  • Karabiner only maps connected devices, so this won't work if you're using VNC, Splashtop, etc. However, the KeyBindings answers do work for Splashtop (which I'm currently using) and I'd assume they'd also work for VNC. – Bezewy Dec 03 '15 at 22:43
  • 1
    Just download the addon, and in the System Preferences panel, I did not find it in System Preferences. I found it in the LaunchPad. Mac version: El Capitan 10.11.3 – arun Jun 02 '16 at 17:07
  • 1
    As of today, "Karabiner does not work on macOS Sierra at the moment." – james.garriss May 19 '17 at 12:32
  • 2
    @james.garriss Give Karabiner-Elements a go - same author though rewritten from the ground up to support Sierra (it's still in development so they're quite a few rough edges) - https://github.com/tekezo/Karabiner-Elements – jklp May 21 '17 at 00:36
  • 7
    @jklp Unfortunately the functionality that is needed for remapping Home and End keys on Apple extended keyboard isn't yet available in Karabiner Elements.

    I personally seem to have the muscle memory for Ctrl-a, Ctrl-e when working in the console, but when working in a GUI app like Sublime, it's super difficult to remember. For Sublime (specifically) there is a solution, however: https://coderwall.com/p/upolqw/fix-sublime-text-home-and-end-key-usage-on-mac-osx

    – Ville Jun 19 '17 at 18:09
  • 29
    If you are in 2020 and like me you have no idea how to setup Karabiner, go to Complex modifications tab > Add rule > Import more rules from the Internet, and then search for "home" and you will find some rules to import. – Rodrigo Saling Apr 17 '20 at 03:29
  • 7
    If you are in 2021 and you want the For PC Rules, go to Complex modifications tab > Add rule > Import more rules from the Internet, and then search for "PC" and you will find some rules to import. (Thanks @RodrigoSaling) for the initial tip – JJS Jan 20 '21 at 13:33
  • 1
    I wouldn't ever consider using a tool that requires monitoring all keyboard input even if not the active application, open source or not. – connexo Mar 25 '21 at 12:15
  • In July 2021, I use Personal PC-Style Shortcuts(@Bave Lee) and import Home key to the beginning of the line (Control + a) and End key to the end of the line (Control + e) – Player1 Jul 09 '21 at 16:07
  • Just worked for me on 12.3. Didn't have to restart or log out. Option-clicked Finder and re-launched it and it worked fine in FF, Safari, and default macOS applications. Didn't work in Terminal or iTerm. After reading @Player1's comment I'm tempted to remap to Ctrl+a and Ctrl-e instead though that will bring different incompatibilities. – joshfindit Mar 21 '22 at 00:14
55

Thanks to this article, I figured out how to re-bind the Home and End keys to line based actions on a per-user basis that works across keyboard layouts.

You need to create a dictionary file with the keycodes and new commands to map to, but first make sure the folder where this will be placed exists by opening a Terminal and running:

$ mkdir -p ~/Library/KeyBindings

Then create or edit the file at ~/Library/KeyBindings/DefaultKeyBinding.dict. If it didn't exist before, add the whole section below. If it does exist, just add the four new rows inside the block.

{
    "\UF729"  = "moveToBeginningOfLine:";
    "\UF72B"  = "moveToEndOfLine:";
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";
}

In order to activate the settings you will need to logout of your user and login again.

Note that this covers both the normal action of moving the cursor and the Shift+Home/End combination to select durring cursor movement.

Caleb
  • 7,093
22

I'm using OS X Sierra, and the ~/Library/KeyBindings/DefaultKeyBinding.dict solution suggested by other users partially worked: some apps like TextEdit now have the desired behavior, but other apps don't. Google Chrome and Slack are two that don't seem to respect the DefaultKeyBinding.dict file.

To fix the remaining apps, I used BetterTouchTool (legacy) / BetterTouchTool (current) to create app-specific keyboard shortcuts binding Home and End to OS X's native shortcuts Ctrl+A and Ctrl+E. BetterTouchTool is not free, but there's a 45-day trial period.

To do this:

  1. Install and launch BetterTouchTool
  2. Go to the Gestures > Keyboard tab
  3. Under "Select Application", click + and choose the app you want to fix.
  4. Click "Add New Shortcut", assign the Home key in the "record shortcut" field, and set "Trigger other keyboard shortcut" to Ctrl+A. Repeat for End and Ctrl+E.
  5. When you're done the panel should look like this:BetterTouchTool panel
  6. Under BetterTouchTool's Advanced Settings, allow it to run on startup.

Note: don't quit the BetterTouchTool app or it will stop intercepting key presses. Just close its window and it should continue working in the background.

evan
  • 103
mamacdon
  • 321
  • Thanks - just used this on El Capitan as I have already paid for BetterTouchTool, and it works fine with Chrome, Slack and other apps. – RichVel Sep 19 '17 at 08:41
  • For selecting while jumping (e.g. in word docs or onenote) I you need to also map shift-home to shift-command-left-arrow (note arrow, not control A) and similarly for end. Got it from here https://community.folivora.ai/t/make-your-home-and-end-keys-work-like-windows/5046 – Rhubarb Mar 20 '20 at 09:55
  • Finally! I have a solution for this missing mapping. Thanks for the tip. – jerik Nov 26 '20 at 07:49
  • I've since switched to Karabiner Elements as explained in Jason Waters' answer. It's easier to set up. – mamacdon Nov 27 '20 at 16:18
  • 1
    This solution works great! Only difference is that the UI looks a bit different in 2022 and I had to do make the assigned actions be ⌘ <- and ⌘ ->. – pir Mar 02 '22 at 14:33
11

I accomplished this using Karabiner Elements.

You need to update the rules section of ~/.config/karabiner/karabiner.json with the JSON array from code below. Doing so remaps the home and end keys to work the way they work on pc/windows.

{
  "rules": [
    {
      "description": "change home key to command + left_arrow",
      "manipulators": [
        {
          "from": {
            "key_code": "home"
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "change home key to command + left_arrow while presing shift (selection)",
      "manipulators": [
        {
          "from": {
            "key_code": "home",
            "modifiers": {
              "mandatory": [
                "left_shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_command",
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "change end key to command + right_arrow",
      "manipulators": [
        {
          "from": {
            "key_code": "end"
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "change end key to command + right_arrow while presing shift (selection)",
      "manipulators": [
        {
          "from": {
            "key_code": "end",
            "modifiers": {
              "mandatory": [
                "left_shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_command",
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}

see also: github gist

enter image description here

Jason Waters
  • 111
  • 1
  • 4
  • You can simplify this by using "modifiers": { "optional": [ "any"] } to avoid duplicating a rule for selection (this formatting in comment is horrible, copy paste to editor to read properly I s'ppose)

    { "description": "Home is Beginning of line", "type": "basic", "from": { "key_code": "home", "modifiers": { "optional": [ "any"] } }, "to": [{ "key_code": "left_arrow", "modifiers": [ "left_command" ] }] }

    – n-smits Sep 14 '21 at 10:07
  • 2
    A rule to achieve this can also be imported from the repository, by going into the Complex modifications section and clicking on Import more rules from the internet, that will open a browser at https://ke-complex-modifications.pqrs.org/, search for Home and grab Home and End from the results. Tested on Big Sur. – Giovanni Toraldo Jan 07 '22 at 17:08
10

I'm using the awesome KeyRemap4MacBook with the custom settings below.

It fixes Home/End in most applications and doesn't screw up iTerm2.

From https://gist.github.com/lhotari/6134223181439b9ed0a1

<?xml version="1.0"?>
<!-- ~/Library/Application Support/KeyRemap4MacBook/private.xml -->
<!-- Custom keyboard mappings for MBP using https://pqrs.org/macosx/keyremap4macbook/ -->
<root>
    <item>
        <name>Lari's PC Style Home/End</name>
        <appendix>(Change Home to Command+Left)</appendix>
        <appendix>(Change End to Command+Right)</appendix>
        <appendix></appendix>
        <appendix>{{ PC_STYLE_BINDINGS_IGNORE_APPS_DESCRIPTION }}</appendix>
        <identifier>lari.remap.pclikehomeend</identifier>
        <block>
            <only>DREAMWEAVER</only>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME, KeyCode::HOME, ModifierFlag::SHIFT_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,  KeyCode::END,  ModifierFlag::SHIFT_L</autogen>
        </block>
        <block>
            <only>BLUEFISH,WORD,EXCEL,POWERPOINT</only>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME, KeyCode::HOME</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,  KeyCode::END</autogen>
        </block>
        <!--
        <block>
            <only>EMACS, TERMINAL, X11, ECLIPSE</only>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME, KeyCode::A, ModifierFlag::CONTROL_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,  KeyCode::E, ModifierFlag::CONTROL_L</autogen>
        </block>
         -->
        <block>
            <not>{{ PC_STYLE_BINDINGS_IGNORE_APPS }}</not>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_UP,    ModifierFlag::COMMAND_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL, KeyCode::CURSOR_UP,    ModifierFlag::COMMAND_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,  MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_DOWN,  ModifierFlag::COMMAND_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,  MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL, KeyCode::CURSOR_DOWN,  ModifierFlag::COMMAND_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_HOME,             KeyCode::CURSOR_LEFT,  ModifierFlag::COMMAND_L</autogen>
            <autogen>__KeyToKey__ FROMKEYCODE_END,              KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
        </block>
    </item>
</root>
pjpscriv
  • 105
9

@Lri's answer is awesome (thank you so much; this was driving me insane), but I ended up modifying it a little.

(In this answer, I use the non-Apple names for keys, so Command = Super and Option = Alt)

SuperLeft and SuperRight used to actually be mapped to moveToLeftEndOfLine and moveToRightEndOfLine. Using moveToBeginningOfLine and moveToEndOfLine, like @Lri does, may cause inconsistent behaviour.

There are whole bunch of other differences between the Apple shortcuts and literally everybody else's shortcuts that I added. For example, ControlLeft and ControlRight are supposed to move between words; not AltLeft and AltLeft. I don't think this is exhaustive, but it's working pretty well for me right now. I assumed the user has already swapped the Control and Super keys to fix cutting, copying, and pasting.

~/Library/KeyBindings/DefaultKeyBinding.dict:
{
    "\UF729"   = moveToLeftEndOfLine:; // home
    "\UF72B"   = moveToRightEndOfLine:; // end
    "$\UF729"  = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B"  = moveToEndOfLineAndModifySelection:; // shift-end
&quot;@\UF700&quot;  = moveUp:;  //super-up
&quot;@\UF701&quot;  = moveDown:;  //super-down
&quot;@\UF702&quot;  = moveWordLeft:;  //super-left
&quot;@\UF703&quot;  = moveWordRight:;  //super-right

&quot;@$\UF700&quot; = moveUpAndModifySelection:;  // super-shift-up
&quot;@$\UF701&quot; = moveDownAndModifySelection:;  // super-shift-down
&quot;@$\UF702&quot; = moveWordLeftAndModifySelection:;  // super-shift-left
&quot;@$\UF703&quot; = moveWordRightAndModifySelection:;  // super-shift-right

&quot;@\UF728&quot;  = deleteWordForward:;  // super-delete
&quot;@\U7F&quot;    = deleteWordBackward:;  // super-backspace

}

jaume
  • 15,010
8

I found the following useful for iterm2 and zsh with quotes from here:

Open iTerm > Preference. Go to profiles tab > Keys. Then click on the + button on the bottom of the keys list, press Home (or Fn+left arrow on the apple cordless keyboard), under Action select Send Escape Sequence, and then type [1~

Repeat for End key with [~4 for escape key sequence.

If you're using zsh, also do this:

1) Place the following in your ~/.zshrc file

bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line

2) Run source ~/.zshrc in any open terminals.

  • iTerm2 also has a "Natural text editing" key mapping preset that includes this behavior. – Matt M. May 01 '17 at 20:37
  • Needs to be changed to bindkey "^[[~4" end-of-line. Note the position of the 4. – Ty. Jun 15 '17 at 17:06
  • @Ty Thanks, but can you explain why? The original source, as well as https://github.com/reenhanced/zsh-config/blob/master/lib/key-bindings.zsh and https://github.com/ThiefMaster/zsh-config/blob/master/zshrc.d/keybinds.zsh use "^[[4~" – RationalDev likes GoFundMonica Jun 15 '17 at 17:25
  • I'm not well versed in these escape sequences but for me ^[[4~ echos out 4 while ^[[~4 moves the cursor to the end of the line. – Ty. Jun 15 '17 at 20:51
  • @Ty Interesting. I did some searching to figure out why, but I have only been able to find examples of ^[[4~. What kind of keyboard and character encoding are you using, maybe that makes a difference? – RationalDev likes GoFundMonica Jun 16 '17 at 02:12
  • What worked for me for iTerm2 was this answer here: https://apple.stackexchange.com/a/389587 which suggests sending the hex codes 0x01 for home and 0x05 for end. – Tobias Jun 17 '21 at 16:54
7

Imho the best tool to make keyboard changes is indeed Karabiner (old name KeyRemap4MacBook). Open source (https://github.com/tekezo/Karabiner) but also available as application (https://pqrs.org/osx/karabiner/index.html.en). I have been searching quite a long time and I have never find anything better.

7
  1. Open this file
/Library/KeyBindings/DefaultKeyBinding.dict (apply to all users)

or

~/Library/KeyBindings/DefaultKeyBinding.dict (apply to yourself)
  1. Add these lines:
{
  "\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
}
pjpscriv
  • 105
Dio Phung
  • 201
  • 1
    This answer seems to be just rehashing what's already explained in other answers but substituting your favorite set of keys without much explanation. Perhaps you could add a little more value by explaining where this differs from other solution(s). – Caleb May 07 '20 at 12:04
  • 3
    @Caleb: he adds moveToBeginningOfDocument and moveToEndOfDocument, which I find indispensable. – Jeff Wright Jun 05 '21 at 09:58
  • https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x/ – felickz Apr 01 '22 at 16:20
3

This from iExplain works for Big Sur.

{
    /* Remap Home / End keys */
/* Home Button*/
&quot;\UF729&quot; = &quot;moveToBeginningOfLine:&quot;; 

/* End Button */
&quot;\UF72B&quot; = &quot;moveToEndOfLine:&quot;; 

/* Shift + Home Button */
&quot;$\UF729&quot; = &quot;moveToBeginningOfLineAndModifySelection:&quot;; 

/* Shift + End Button */
&quot;$\UF72B&quot; = &quot;moveToEndOfLineAndModifySelection:&quot;; 

/* Ctrl + Home Button */
&quot;^\UF729&quot; = &quot;moveToBeginningOfDocument:&quot;;

/* Ctrl + End Button */
&quot;^\UF72B&quot; = &quot;moveToEndOfDocument:&quot;;

/* Shift + Ctrl + Home Button */
&quot;$^\UF729&quot; = &quot;moveToBeginningOfDocumentAndModifySelection:&quot;;

/* Shift + Ctrl + End Button*/
&quot;$^\UF72B&quot; = &quot;moveToEndOfDocumentAndModifySelection:&quot;; 

}

ina
  • 841
1

The original question is already answered but I have put together the equivalence of missing standard layout keyboard keys (Home, Backspace, Page etc) on a Mac here.

Daniel
  • 34,803
tash
  • 119
-5

You can also remap keyboard keys, as well as customize your mouse and trackpad in all kinds of cool ways, with the free BetterTouchTool, available at http://blog.boastr.net/. An excellent solution for customizing the workings of your input devices!

grg
  • 201,078
  • 4
    Could you expand your answer with instructions on how to use the specified software to solve the original problem? – grg Jun 11 '15 at 18:35
  • 3
    Not free in either the "Free Beer" or "Freedom" senses. 45-day trial, closed-source, paid software. – Wyatt Ward Aug 05 '17 at 05:43