Make Home & End keys behave like Windows on Mac OS X

I’ve been using Mac OS X daily since 2001 when I purchased my Titanium PowerBook. I still can’t get used the Home and End key behaviour.

If, like me, you want 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

This remapping does the following in most Mac apps - including Chrome (some apps manage their key handling directly):

  • Home and End will go to start and end of line
  • ShiftHome and ShiftEnd will select to start and end of line
  • CtrlHome and CtrlEnd will go to start and end of document
  • ShiftCtrlHome and ShiftCtrlEnd will select to start and end of document

Note that you need to reboot after creating this file for it to take effect. Also make sure your editor does not append TXT to the end of it!

If you have a PC keyboard with LED back-lighting and would like the scroll-lock, num-lock or caps-lock LEDs on when using your Mac check out my free SetLEDs for Mac


66 responses

  1. Avatar for Alkirah

    Amazing! Works like a charm on latest el capitan version. Thanks!

    Alkirah 2 September 2016
  2. Avatar for Alex

    For words selection like in Windows can be used next rules:

    "^\UF702" = (moveWordLeft:); // ctrl-left "^$\UF702" = (moveWordLeftAndModifySelection:); // ctrl-shift-left "^\UF703" = (moveWordRight:); // ctrl-right "^$\UF703" = (moveWordRightAndModifySelection:); // ctrl-shift-right

    Alex 30 September 2016
  3. Avatar for Ryan

    This worked on the latest macOS as well. Thank you.

    Ryan 26 January 2017
  4. Avatar for Martin

    also works on Version Mac OS X 10.12.4 (16E195). Awesome thanks, I love it :-) Is there some more stuff how to use that? Would love if I can change all my favourite shortcuts in one place

    Martin 10 May 2017
  5. Avatar for Shay

    DefaultKeyBinding.dict is ignored by some applications like XCode and Firefox and in some views like in WebKit web inspectors.

    Also good luck mapping the function key, caps lock (read up on that- a large amount of people want that).

    I am a left-hand mouser and wanted cut/copy/paste functions with the right hand. Trouble is, you can't map control+fn (for copy), nor shift+fn (for paste), which are the keys that map positionally on a PC keyboard (I'm talking for PC keyboards with 2 rows of three keys: Ins, Home, Pg UP / Del, End, Pg Down).

    Another issue is when you are like me, doing lots of Windoz in a VM (Oracle Virtualbox) and remote desktop (Microsoft Remote Desktop for MacOS). There you need to pass different keys so everything works. Same with terminal apps.

    Karabiner is the go-to tool for key remapping, but there are issues with Sierra (Karabiner-elements is the next thing, but still a work in progress.

    So, I built something that works in all contexts (ok, almost all) using Hammerspoon, a superb tool for automation on the Mac:

    Shay 8 November 2017
  6. Avatar for Ashton Cormallen

    You are using ^ to denote the Ctrl key but how do I denote the Cmd key?

    Ashton Cormallen 28 December 2017
  7. Avatar for andyrak

    You can denote the Cmd key with ⌘ (PLACE OF INTEREST SIGN, Unicode: U+2318, UTF-8: E2 8C 98).

    Hope that helps.

    andyrak 27 February 2018
  8. Avatar for Tyler

    It has been SO hard to accept the loss of functionality of the Home/End keys after moving to Mac full time. What a blessing your tip/snippet is! Thanks, Damien!


    Tyler 3 August 2018
  9. Avatar for Eric

    Hey, thanks for this! However, I don't see it working in some apps in Chrome. Any suggestions. - Eric

    Eric 7 August 2018
  10. Avatar for Roger Miller

    Yay! Working on MacOS High Sierra

    Roger Miller 16 August 2018
  11. Avatar for pale

    Would it be strange if I were to propose to you on the spot?

    I've been using PC and Linux since 1997, and just got a Mac to get into iOS development. You saved my efficiency.

    pale 24 August 2018
  12. Avatar for Brian

    This didn't work for me on Mojave. I had to use BeginningOfLine instead of BeginningOfParagraph. Here is my file:

    "\UF729"  = moveToBeginningOfLine:; // home
    "\UF72B"  = moveToEndOfLine:; // end
    "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
    "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
    "^\UF72B" = moveToEndOfDocument:; // ctrl-end
    "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
    "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
    Brian 21 March 2019
  13. Avatar for Jerry Baker

    Nice, works like a charm for High Sierra. By the way, restarting computer isn't necessary. Restarting finder should be sufficient

    command: killall Finder


    Jerry Baker 29 April 2019
  14. Avatar for Jonathan Feinberg

    Yayyy! Working perfectly in Catalina, and Jerry Baker's suggestion to nuke Finder worked perfectly without a reboot.

    Jonathan Feinberg 25 March 2020
  15. Avatar for Martin

    Worked for me on Catalina. The default behaviour in Chrome was driving me nuts.

    Many thanks!

    Martin 7 April 2020
  16. Avatar for Eric

    You just saved me from hours of agony in quarantine! (MacOS 10.15.4)

    Eric 14 April 2020
  17. Avatar for Ross

    Wonderful! This WFH period has really forced me to use my work laptop (mac) as my daily driver (as opposed to a modified Ubuntu at work) and this HOME/END thing was driving me nuts.

    Ross 16 April 2020
  18. Avatar for Brian

    This is huge!! Thanks!!

    Brian 16 April 2020
  19. Avatar for John

    As other have said this is fantastic. Thank you!

    John 22 April 2020
  20. Avatar for Evey Hammond

    Big thanks for this.

    For those like me, who aren't regular Terminal users and who don't just intuitively know what "create a file... [in your library] with the following contents" means: 1)Open Terminal. (Applications>Utilities> Terminal)

    1. Type/copy paste in "mkdir -p ~/Library/KeyBindings/" and hit enter Type/copy paste in "touch ~/Library/KeyBindings/DefaultKeyBinding.dict" and hit enter Type/copy paste in "touch ~/Library/KeyBindings/DefaultKeyBinding.dict" and hit enter

    2. A Notepad window will pop up. Copy-paste Damien's code into that window and hit save. Here it is again: { "\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 } Copy

    1. Quit and relaunch apps for this to take effect.
    Evey Hammond 6 May 2020
  21. Avatar for FredS

    WFH indeed... I googled again for a solution and reading the instructions I found I had created that file in the past (this issue has been annoying me long already) but it doesn't seem to work. I have Catalina 10.15.4. Any hint?

    FredS 8 May 2020
  22. Avatar for alexrqs


    alexrqs 25 May 2020
  23. Avatar for trennor

    "3) A Notepad window will pop up. Copy-paste Damien’s code into that window and hit save. "

    On Catalina, this does not happen and I cannot find ANY way to save this script. "Text"app and Script Writer REFUSE to save it where directed. I'm at the end of my wits here; HOW is this actually accomplished? I'm attempting to save, as suggested, in ~(home/dir) ~/Library/KeyBindings/Default/KeyBinding.dict, but every time i check the file in terminal, it's empty. What, please, is going on?

    trennor 25 May 2020
  24. Avatar for Heinz Hemken

    Yay! Thanks!

    [Insert lengthy, obscenity-laced vituperation over this and a number of other "natural" MacOS behaviors]

    Heinz Hemken 26 May 2020
  25. Avatar for Robert

    Can confirm that Damien's code plus Evey's file creation instructions works on macOS Catalina (Version 10.15.5). Thank you both!

    Robert 4 June 2020
  26. Avatar for Rob

    WOW. What a difference it makes to have those keys remapped in a sane way. I gotta wonder what the heck apple was thinking. My guess is "Well, we only added those keys to keep that PC users happy. Let's really mess with them. We don't need to make them happy, we've got truckloads of brain-washed fanboy to keep up our User satisfaction numbers up".

    Rob 6 June 2020
  27. Avatar for Sergio Schuler

    Works perfectly on Catalina - used Command instead of Ctrl though.

    SAVED MY PRODUCTIVITY. Oh my, thanks!

    Sergio Schuler 8 June 2020
  28. Avatar for Dylan

    I don't think this is working on Catalina.

    Dylan 8 June 2020
  29. Avatar for infoman

    Thank you!!! This worked like a charm on 10.15.5. "touch" command didn't open notepad for me. I instead used finder to navigate to the file and drag it to notepad manually.

    infoman 8 June 2020
  30. Avatar for Magician

    Thank you for this, it worked great

    Magician 14 June 2020
  31. Avatar for Vaibhav

    Awesone..! It saved my time and that was so frustating to work with documents. Thanks.

    Vaibhav 17 June 2020
  32. Avatar for martin

    Thank you, on Catalina with Logitech K850 works fine with text editors, but Safari intercepts home/end keys to go begin/end of page, no matter if cursor is inside of a text box.

    martin 23 June 2020
  33. Avatar for Amy

    Thank you so much for this!! As someone brand new to Terminal, I had difficulty following only the instructions on this page to get things working. In case this helps anyone else, here's a step-by-step of how I did it in Catalina:

    1. Open TextEdit, paste in the contents as given by Damien, and "Save As" DefaultKeyBinding.dict to your Documents folder.
    2. Open Terminal (found in Applications/Utilities/)
    3. Type in the following command and hit enter. (This will move the file you created to the desired directory): ~mv /Documents/DefaultKeyBinding.dict ~/Library/KeyBindings/DefaultKeyBinding.dict
    4. Restart your computer.
    Amy 10 July 2020
  34. Avatar for Lance

    For those having trouble, make sure you created an actual .dict file, as opposed to a .txt file. To verify this: Right Click the file > Get Info. Expand Name & Extension to remove the '.txt' if it is present and save.

    I also had to use "BeginningOfLine" instead of "BeginningOfParagraph" as user Brian mentions above.

    Lance 14 July 2020
  35. Avatar for Lolo

    Either I'm dull or struggling to get this to work!

    Here's my code; a mix of Damien's, Brian's and suggestions from Sergio and Lance. Running Catalina 10.15.5:

    { "\UF729" = moveToBeginningOfLine:; // home "\UF72B" = moveToEndOfLine:; // end "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end "^\UF729" = moveToBeginningOfDocument:; // command-home "^\UF72B" = moveToEndOfDocument:; // command-end "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // command-shift-home "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // command-shift-end }

    Then after making sure it's a .dict file, adding to KeyBindings, and then killall Finder in terminal, still no dice. What could I be doing wrong here?

    Lolo 21 July 2020
  36. Avatar for Lance


    Try this: make sure your text in the .dict file is plain text and not rich text. To do this, go to Format > Make Plain Text and Save. Then killAll Finder and try again.

    Lance 2 August 2020
  37. Avatar for Kevin

    @Lolo If you copied and pasted code from others on this webpage, your double-quote character could be wrong. Replace everything that looks like a double-quote with an actual double-quote. This has caused me problems many times when writing code.

    Also, your command-* key mappings are really ctrl-* mappings because you are using the '^' character at the beginning of the sequence. If you really want to use the command key, substitute the '^' character with a '@' character.

    Kevin 4 August 2020
  38. Avatar for emmap

    Now it works on Catalina 10.15.6:

    1- given ownership to the user MyUser to the folder /Users/MyUser/Library/KeyBindings/ and to the file DefaultKeyBinding.dict chown MyUser /Users/MyUser/Library/KeyBindings/ chown MyUser /Users/MyUser/Library/KeyBindings/DefaultKeyBinding.dict

    2- given to all users all rights to the folder /Users/MyUser/Library/KeyBindings/ and to the file DefaultKeyBinding.dict chmod 777 /Users/MyUser/Library/KeyBindings/ chmod 777 /Users/MyUser/Library/KeyBindings/DefaultKeyBinding.dict

    3- then saved the file into ASCII format with CRLF line endings instead of LF.

    emmap 9 August 2020
  39. Avatar for MrVestek

    This also works well on Catalina, however I find that the page will still scroll up / down when these keys are pressed, even though the behaviour is now as expected.

    Anybody know of a way to prevent this?

    Thanks so much!

    MrVestek 28 August 2020
  40. Avatar for Foil

    Can I get additional clarification with how to get it working on Catalina 10.15.6? I don't really understand the instructions that @emmap has posted above. For steps 1 & 2, my user already has read and write access to the file and folder, and for step 3, I'm not really sure what any of it means.

    Foil 29 August 2020
  41. Avatar for Rich

    After trying to follow everything on here to no success, I found a website that had easy to follow instructions. Most importantly, my home and end keys work as I desire.

    Fire up your favorite terminal (you’re probably using iTerm2 like the rest of the world)

    mkdir -p ~/Library/KeyBindings nano ~/Library/KeyBindings/DefaultKeyBinding.dict

    The seasoned programmer could just go vi ~/Library/KeyBindings/DefaultKeyBinding.dict or more likely vim, but for the rest of us, nano works like a regular text editor.

    In the empty file you just opened, copy and paste the following:

    { /_ 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:";


    Having pasted it into the file, press ctrl + x and answer with y when you get the question if you want to save.

    Well that’s it. Now you have successfully remapped the home and en button for macOS. You need to restart to make the changes happen.

    Rich 4 September 2020
  42. Avatar for Jeff R

    I have been putting up with this nonsense for a couple of years. Thanks for putting an end to a very real struggle. So much happier now. Thanks very much for sharing this!

    Jeff R 10 October 2020
  43. Avatar for Frankie

    Thank you so much for this post and thank you for all the comments. Using what @Rich wrote on 9/4/2020, I was able to make the Home and End keys work as I expect them to. And it works on Firefox. What a HUGE difference in reducing my stress level at the keyboard. And it works for Firefox and everything I've tested so far. I'm on Catalina 10.15.7.

    Frankie 19 October 2020
  44. Avatar for Gilad

    I can confirm that it works on Macbook Pro (16-inch, 2019) - Catalina 10.15.7.

    Gilad 2 November 2020
  45. Avatar for Sean

    Here is a solution I wrote to deal with different apps, virtual machines, remote desktop, etc. Note: You have to install the awesome Hammerspoon Lua scripting framework, and tweak some config files. But it's pretty comprehensive, and open source.

    Sean 12 November 2020
  46. Avatar for Jam

    Still works as of 20jan20 on Big Sur.

    Had to create the folder and file. Thanks!

    Jam 20 January 2021
  47. Avatar for Jess

    Same as Jam on Big Sur - make folder +file (text edit, save, and then delete extension from 'Get Info' menu) - but it works and I am so grateful! End key is my life.

    Jess 20 February 2021
  48. Avatar for Evey Hammond

    Seems like I gotta do this once a year, and every time the old tricks don't work. This time terminal commands don't lead to a text edit file opening up, like some other users.

    I was able to do it without using terminal at all, though. I created a Text Edit file, pasted in the code Damien gave above, saved it as 'DefaultKeyBinding.dict'(used Get Info, cmd-i to make sure it really was a .dict file not .rtf, as others have said), then placed that file in my hard drive>Library>KeyBindings. (You may need to make this folder, I think my earlier flailing around in Terminal did this. There is also a Library folder under my user name, using one or both seems to make no difference.)

    Every time I do this it seems to work in fewer programs, though. I'm on Big Sur 11.2.2, and it doesn't work in Stickies, Messages, Open Office, and probably more. Using moveToBeginningOfParagraph versus moveToBeginningOfLine seems to make no difference. I haven't tried Sean's suggestion of Hammer Spoon yet.

    Evey Hammond 7 March 2021
  49. Avatar for mosesvii

    For whatever reason I was having issues with the keybinding stuff. After looking at a YouTube vid I found what I think is a better solution. At least a more comprehensive one.

    Google 'Karabiner - Elements'and download it. It's free... and works on my new M1 Mac Mini. Using the tool i was able to download loads of Windows keymappings at the click of a button.

    I know i could learn the mac shortcuts, and will over time. But now having my Home and End button back, among other shortcuts, is great!

    In the tool click the 'Complex Modifications' tab, then 'Add rule'. In the new window, clicking the 'Import more rules from the Internet' button opens up a webpage with predefined key mappings. There are so many there. I found one called "Windows shortcuts on macOS". Imported it, and enmabled the keys i wanted. No rebooting, no messing with Terminal.

    I'm super happy :)

    mosesvii 11 March 2021
  50. Avatar for aGreycat

    I tried what mosesvii suggested and It worked perfectly for me. 2019 iMac 27" running Big Sur 11.0.1

    aGreycat 19 March 2021
  51. Avatar for Jeremy

    It works for me on Big Sur except for the Messages app.

    Jeremy 23 March 2021
  52. Avatar for Steven Yong

    Works for me using Big Sur. Apps like Notes are not working.

    Steven Yong 26 March 2021
  53. Avatar for Todd

    mosesvii's suggestion about "Karabiner - Elements" is working great on latest version of Mac OS as of now. Installation and getting system security settings configured properly took a few minutes and was a bit confusing, but once I got it going it's working a treat.

    Todd 26 March 2021
  54. Avatar for DCA

    Just installed Karabiner - Elements and all the necessary rule and no love for me on MacOS Big Sur 11.2.3. I am, however, using a Logitech K860 which comes with its own software (Logi Options) for key reassignment. I have a feeling Logi Options is preempting Karabiner - Elements.

    DCA 30 March 2021
  55. Avatar for KK4JO

    Just tried the suggested edit to the DefaultKeyBinding file. For me, on a Mac mini M1 running 11.5.1 results are great except that some apps won't work. Apparently they have their own key bindings.

    Oh, same results when I either logout and log back in or reboot. We may be trying to get some windows-like behavior going but we don't have to reboot to have our account configuration files read, just log in.

    KK4JO 29 July 2021
  56. Avatar for Other Rich

    Was struggling trying to get ctrl + left/right arrow to perform left word/right word in mac BIG Sur. You will have to unmap Mission Control ctrl left/right in System Preferences->Keyboard->Shortcuts.

    Otherwise, the above worked well

    Other Rich 8 August 2021
  57. Avatar for sam

    just setup on BigSur, and restarted... no change

    cat ~/Library/KeyBindings/DefaultKeyBinding.dict
      "\\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
    sam 10 August 2021
  58. Avatar for DriveByPoster

    I too have benefitted from your wisdom -- as a Windows user going back to 2.0, having Macs in my life is always confusing, and my current job requires that I use one. This has removed a huge source of frustration. Now if only I can figure out how to deal with a Mac with a PC keyboard that has no Windows key... there aren't enough keys in the right places to map command/control/option etc. to.

    DriveByPoster 24 September 2021
  59. Avatar for MisterA

    I too would like to declare my undying love for saving me lots of swearing and lost time when developing on MacOS.

    Working fine on BigSur 11.6

    Less techy peeps: don't be put off by earlier comments that terminal access is required - it's not required.

    First use any editor (TextEdit if that's all you have) to create the file and save it to an easily accessible folder, such as Documents.

    Then to access Library folder just hold down option (alt) while clicking Go menu in Finder - Library will be in the list, you can then use Finder to create the KeyBindings folder in there as normal and drag in the DefaultKeyBinding file you made earlier.

    To apply the settings without rebooting just click the apple in top left, choose Force quit... select Finder and choose Relaunch. You'll also need to quit/restart any open applications.

    Additonal usful bindings that are missing from this post to make it more productive and Windows:

    "^\UF702" = "moveWordBackward:"; /_ Ctrl + LeftArrow /
    "^\UF703" = "moveWordForward:"; /
    Ctrl + RightArrow /
    "^$\UF702" = "moveWordBackwardAndModifySelection:"; /* Shift + Ctrl + Leftarrow */
    "^$\UF703" = "moveWordForwardAndModifySelection:"; /
    Shift + Ctrl + Rightarrow _/

    Though as Other Rich says above you'll need to disable the Mission Control ctrl left/right bindings in System preferences for those to work.

    MisterA 1 October 2021
  60. Avatar for Rahul Sarkar

    This worked. You are a life saver. I was getting so frustrated using my PC keyboard on my Macbook.

    In the middle of learning a new programming language, it's no good that I can't get to the end of a line or the beginning of a line easily! Gets in the way of learning.

    Thank you so much for sharing this and help the community! Kudos and Respect!

    Rahul Sarkar 3 November 2021
  61. Avatar for j. g.

    Thanks for this writeup.

    Unfortunately vscode does not support this settings file, and the relevant issue was closed (not enough upvotes)

    But it's possible to customize key bindings directly in vscode:

    cmd-shift-p > Keyboard shortcuts > type cursor in the search field

    j. g. 11 November 2021
  62. Avatar for j. g.

    Since vcode does not support this file, here's what I've put to my keybindings.json in vscode to make the muscle memory work in vscode too (note: I bound all shortcuts to both ctrl-... and cmd-... just to make my life easier; and I had to unbind some MacOS-specific vscode default keybindings).

        "key": "ctrl+home",
        "command": "cursorTop",
        "when": "textInputFocus"
        "key": "cmd+home",
        "command": "cursorTop",
        "when": "textInputFocus"
        "key": "cmd+end",
        "command": "cursorBottom",
        "when": "textInputFocus"
        "key": "ctrl+end",
        "command": "cursorBottom",
        "when": "textInputFocus"
        "key": "ctrl+shift+home",
        "command": "cursorTopSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+home",
        "command": "cursorTopSelect",
        "when": "textInputFocus"
        "key": "ctrl+shift+end",
        "command": "cursorBottomSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+end",
        "command": "cursorBottomSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+left",
        "command": "-cursorHomeSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+left",
        "command": "cursorWordLeftSelect",
        "when": "textInputFocus"
        "key": "ctrl+shift+left",
        "command": "-editor.action.smartSelect.shrink",
        "when": "editorTextFocus"
        "key": "ctrl+shift+left",
        "command": "cursorWordLeftSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+right",
        "command": "-cursorEndSelect",
        "when": "textInputFocus"
        "key": "shift+cmd+right",
        "command": "cursorWordRightSelect",
        "when": "textInputFocus"
        "key": "ctrl+shift+right",
        "command": "-editor.action.smartSelect.expand",
        "when": "editorTextFocus"
        "key": "ctrl+shift+right",
        "command": "cursorWordRightSelect",
        "when": "textInputFocus"
    j. g. 11 November 2021
  63. Avatar for Anders Thor

    Worked like a charm. MBP 13-inch, 2017, Ventura

    Anders Thor 16 October 2023
  64. Avatar for haribol

    Glad to know I'm not the only one who gets really tripped up by the home/end behavior on Mac ... : ) Yes, this is very valuable.

    For all those who don't know, in case it's helpful, Cmd+Left Arrow and Cmd+Right Arrow natively do the same function on Mac, in almost all contexts ... so if you are without a full keyboard, that can help.

    I once had a job working (as a programmer) in an environment of all Macs, after not using Mac much at all for many years, and that was the one huge thing I remember being frustrated by ... my coworkers seemed to think I was nuts. But now I know it's not just me!!

    I prefer using Mac these days, but when I am, I still prefer having Home/End go to beginning/end of line ... it's still easier than Cmd+Left/Right, and muscle memory still has it ingrained. (In order to hit Cmd+Left/Right, you still have to move your right hand over to the arrow keys anyway, which are right under Home and End, at least on most keyboards)

    Thanks again. I used Karabiner and another program for a long time to do this, but it's nicer to know how to do it without installing any other dependencies, and especially for on computers where I may not be allowed to install helper programs to do such things.

    haribol 18 November 2023
  65. Avatar for cyberschlumpf

    MBP 16" of 2023 on Sonoma 14.3. Can't get it to work. Basically tried all variations: With/Without Reboot, killall Finder, etc. "Line" instead of "Paragraph" - the behavior is always the same. Home/End key do not jump to beginning/end of line. Some examples show a double "" some use a single "". Some write the file with a capital Dict, some lowercase.

    My latest attempt:

    cat ~/Library/KeyBindings/DefaultKeyBinding.dict { "\UF729" = moveToBeginningOfLine:; // home "\UF72B" = moveToEndOfLine:; // end "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end "^\UF729" = moveToBeginningOfDocument:; // ctrl-home "^\UF72B" = moveToEndOfDocument:; // ctrl-end "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end }

    Tried 010 Editor and BBEdit - both show the normal behavior to just jump to the begin/end of the document and not the start/end of the current line.

    Anyone here who can definitely say it works for him on Sonoma? (And how his file looks like)


    cyberschlumpf 30 January 2024
  66. Avatar for edhalsim

    Anyone get this to work with Microsoft's OneNote on MacBook Pro? Is there a separate solution for that app.?

    edhalsim 14 March 2024