upolqw
Last Updated: July 15, 2016
·
14.49K
· dayjo
Blue

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

9 Responses
Add your response

7519
1780640 10200579019476925 399806266 n

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

over 1 year ago ·
7521
Blue

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
96523fa9674fbd6b4f2174c7da522b44

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
Blue

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

over 1 year ago ·
16382
Wall normal

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

over 1 year ago ·
16759
B714dbd934173ab40af94af5b549a371

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
None

Thanks so much! Couldn't figure this out.

over 1 year ago ·
17823
Herb

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

11 months ago ·