upolqw
Last Updated: March 03, 2018
·
21.33K
· dayjo

Fix Sublime Text Home and End key usage on Mac OSX

I got confused with not being able to use the Home and End keys to move the cursor to the beginning and end of lines as the default functionality jumps to the beginning and end of the file. I missed this for quickly moving the cursor around, as well as selecting lines of code.

To fix this I added custom key bindings to my Sublime Text preferences.

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

12 Responses
Add your response

7519

Ok. So am I the only one using command + arrows to navigate as home/end ?

over 1 year ago ·
7521

Hah, actually my laptop doesn't have home and end keys so yes I use command + arrows, however when I'm using a usb keyboard I do find them useful, perhaps it's because I'm an ex-pc user?

over 1 year ago ·
7702

If you'd like to add support for using Ctrl+ to go to the beginning/end of the file, it's pretty easy! Just add these lines:

{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof"} },
{ "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof"} },
{ "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} },
{ "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} }
over 1 year ago ·
7703

Excellent addition, I personally use CMD+SHIFT+UP and CMD+SHIFT+DOWN for this functionality.

over 1 year ago ·
16382

Thank you so much! It's been driving me crazy!

over 1 year ago ·
16759

My hands just couldn't get used to hitting CMD left and right. And hitting 3 keys to select a line just seems needless. Because it is. Thanks to this!

over 1 year ago ·
17768

Thanks so much! Couldn't figure this out.

over 1 year ago ·
17823

Thank you!!! This just made Sublime my go to editor.

over 1 year ago ·
27043

Very good and like others here the default behaviour is very annoying since other editors such as IntelliJ behave with end/home being eol/bol

over 1 year ago ·
28798

Thank you very much!
You saved my working day...

over 1 year ago ·
29046

This is awesome! Thank you! Home and End key operation was driving me nuts specifically when using Sublime (for some reason not so much while using Terminal.. maybe because for the command line there's a different set of "rules" in the muscle memory from the UNIX/Linux world).

over 1 year ago ·
29718

woooow this has made my day :') <tears of joy>

8 months ago ·