Skip to content

Instantly share code, notes, and snippets.

@ihor-lev
Last active April 16, 2024 14:54
Show Gist options
  • Star 49 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ihor-lev/120e4c822d145f690f90a3fee77e2e53 to your computer and use it in GitHub Desktop.
Save ihor-lev/120e4c822d145f690f90a3fee77e2e53 to your computer and use it in GitHub Desktop.
Fix Sublime Text Home and End key usage on Mac OSX

Sublime Text Home/End keys default functionality jumps to the beginning and end of the file.

Fix Home and End keys to move the cursor to the beginning and end of lines.

Preferences > Key Bindings - User

Adding the following to the array:

{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }

You can now use the following combinations:

  • Go to beginning of line: Home
  • Go to end of line: End
  • Select from cursor position to beginning of line: ⇧ + Home
  • Select from the cursor position to end of line: ⇧ + End

Fix Sublime Text Home and End key usage on Mac OSX

@singalen
Copy link

Also for Cmd-Home/End:

{ "keys": ["command+home"], "command": "move_to", "args": {"to": "bof" } },
{ "keys": ["command+end"], "command": "move_to", "args": {"to": "eof" } },
{ "keys": ["shift+command+home"], "command": "move_to", "args": {"to": "bof", "extend": true } },
{ "keys": ["shift+command+end"], "command": "move_to", "args": {"to": "eof", "extend": true } },

@eyedean
Copy link

eyedean commented Jun 18, 2022

Finally! Thanks. <3

@abothun
Copy link

abothun commented Oct 14, 2022

This has been driving me bonkers, and my own attempts to tweak the keymappings weren't working. Thank you!

@hehuan2112
Copy link

Thank you so much for this fix! 👍

@chicagomg
Copy link

👍

@lisandrosilvestrini
Copy link

Thanks!

@pnahlous
Copy link

Thanks for the fix!

@Tomatrox
Copy link

Thank you very much!

@konsumer
Copy link

konsumer commented Jun 3, 2023

image

@nicosql
Copy link

nicosql commented Jun 13, 2023

Thank you so much, I'm so glad I stuck it through with Sublime; awesome community and finally the editor itself is becoming awesome!

Odd how bare bones it is out of the box but I suppose that's subjective.

@donnellperkins
Copy link

Really appreciate this! It was very annoying having it jump all the way to the top of the file or end of the file. Glad I wasn't the only one.

@eric182
Copy link

eric182 commented Aug 3, 2023

Thank You.

@dptiwari
Copy link

dptiwari commented Oct 1, 2023

Thanks a lot! really appreciate

@raja-em
Copy link

raja-em commented Oct 20, 2023

You are my man!! love you..

@ram4279
Copy link

ram4279 commented Feb 22, 2024

God bless yall. Thank you

@yoavniran
Copy link

Thank you, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment