Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sublime Text 2 fix for OSX home/end keys
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }
@coldnebo

This comment has been minimized.

Copy link
Owner Author

coldnebo commented Feb 3, 2012

yes, I know, "Command-Left/Right" moves the cursor the way I want. But what is the use of the home/end keys? They move the view but not the cursor? That's pretty useless if you ask me, so I made them more functional and I don't have to do vulcan neck pinches to get it. (yes, there's always CTRL+a/e bash conventions, but sometimes the old wiring for HOME/END kicks in and it is very annoying to try to refind what I was editing-- VERY ANNOYING!). There's another solution that is more invasive, but this works fine for me.

@Dayjo

This comment has been minimized.

Copy link

Dayjo commented Jul 13, 2012

Legend. This will save me so much time in the long run!

Any thoughts on how to get it to work with Shift for highlighting an entire line?

@Dayjo

This comment has been minimized.

Copy link

Dayjo commented Jul 17, 2012

Scrap that... figured it out and added the following lines;

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

This comment has been minimized.

Copy link

tsmith512 commented Nov 19, 2012

My hero! Thank you for this!

@appel

This comment has been minimized.

Copy link

appel commented Nov 28, 2012

There's a way to get this behaviour in all OS X apps.

@engleae

This comment has been minimized.

Copy link

engleae commented Dec 3, 2012

Huge thanks. The home and end keys are back to being useful again.

@dhollenbeck

This comment has been minimized.

Copy link

dhollenbeck commented Jan 18, 2013

+1 Thank you so much.

@nmccready

This comment has been minimized.

Copy link

nmccready commented Jan 28, 2013

Gracias +1

@a-c-m

This comment has been minimized.

Copy link

a-c-m commented Feb 7, 2013

+1 from me here too. HATE how mac thinks home/end should work.

@kylebradshaw

This comment has been minimized.

Copy link

kylebradshaw commented Mar 8, 2013

this was the best gist ever!

@wilhelser

This comment has been minimized.

Copy link

wilhelser commented Mar 11, 2013

+1 Awesome, thank you! Long time Linux user just bought my first Mac 2 days ago and this was driving me insane!

@Scotchester

This comment has been minimized.

Copy link

Scotchester commented Mar 12, 2013

Thank you so much!

@rfsbsb

This comment has been minimized.

Copy link

rfsbsb commented Mar 16, 2013

Hey man, that's very, very helpful! Thank you for sharing it!

@mnme

This comment has been minimized.

Copy link

mnme commented Mar 25, 2013

very nice, also looseroots for the selection thingy

I added also support for the command key: https://gist.github.com/mnme/5235936

@Scotchester

This comment has been minimized.

Copy link

Scotchester commented Jul 5, 2013

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

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

This comment has been minimized.

Copy link

djonatanb commented Aug 15, 2013

Thank you, pressed it several times to celebrate.

@waylonrobert

This comment has been minimized.

Copy link

waylonrobert commented Aug 22, 2013

Amazing - always frustrated me how "Home/End" keys didn't work properly in OS X.

@demisx

This comment has been minimized.

Copy link

demisx commented Sep 18, 2013

Very nice! The life is a joy again.

@ghost

This comment has been minimized.

Copy link

ghost commented Jan 14, 2014

Thanks for this! Just an FYI - this works totally fine in Sublime Text 3 on OSX!

@YA2O

This comment has been minimized.

Copy link

YA2O commented Apr 10, 2014

+1 you made my day

@damurdock

This comment has been minimized.

Copy link

damurdock commented Jun 5, 2014

Kind of late, but thank you for this! It still works in Sublime Text 3 too!

@kingwrcy

This comment has been minimized.

Copy link

kingwrcy commented Jul 18, 2014

nice,huge thanks.

@adarhef

This comment has been minimized.

Copy link

adarhef commented Jul 24, 2014

Thanks, it's been driving me crazy.

@rodmhgl

This comment has been minimized.

Copy link

rodmhgl commented Sep 8, 2014

And just like that, I was 50% more productive. Thanks!

@gcamargo1

This comment has been minimized.

Copy link

gcamargo1 commented Nov 17, 2014

Thanks!!

@bicepjai

This comment has been minimized.

Copy link

bicepjai commented Dec 16, 2014

i believe in GOD now !

@jessegilbride

This comment has been minimized.

Copy link

jessegilbride commented Apr 7, 2015

much thanks.

@jeffwindsor

This comment has been minimized.

Copy link

jeffwindsor commented Apr 11, 2015

many many thanks, this a great frustration relief.

@Krellan

This comment has been minimized.

Copy link

Krellan commented Oct 5, 2015

Wow, great! This is the #1 hit on Google for "sublime text home end", for good reason. These tips have unfscked my Home and End keys! Much appreciation.

Here's all of the suggested edits on this page so far, all edited together, for your convenience:

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

Whitespace added for readability. Simply cut and paste into your keymap file (Sublime Text 2 / Preferences / Key Bindings - User). Takes effect immediately, as soon as that file is saved!

Josh

@Cb-James

This comment has been minimized.

Copy link

Cb-James commented Oct 16, 2015

You da man Josh! And kudos OP's for this life-enhancement.

@GrayedFox

This comment has been minimized.

Copy link

GrayedFox commented Oct 27, 2015

Thank. God. Cheers!

@hitchcott

This comment has been minimized.

Copy link

hitchcott commented Nov 1, 2015

This has made my day.

@cdsaenz

This comment has been minimized.

Copy link

cdsaenz commented Feb 10, 2016

A life saver, thanks guys, I'm moving from Windows to OSX and this was driving me insane in every editor, I might actually decide to buy Sublime after this great fix. Thanks a lot everyone.

@dustinevan

This comment has been minimized.

Copy link

dustinevan commented Mar 7, 2016

Oh thank you so much.

@jebees

This comment has been minimized.

Copy link

jebees commented Mar 10, 2016

for the love of all that is holy, THIS IS WONDERFUL. Thank you Krellan!!

@hzxie

This comment has been minimized.

Copy link

hzxie commented Mar 22, 2016

It works. Thanks a lot!

@raveren

This comment has been minimized.

Copy link

raveren commented Apr 27, 2016

@kellan, godly

@ everyone else: you need this comment.

@victor-ono

This comment has been minimized.

Copy link

victor-ono commented May 5, 2016

Incredible.

@doomsbuster

This comment has been minimized.

Copy link

doomsbuster commented May 5, 2016

@Dayjo Thank you very much. This saves the day.

@racl101

This comment has been minimized.

Copy link

racl101 commented May 18, 2016

Wunderbar! Thanks for sharing this guys. This makes me happy.

@valdean

This comment has been minimized.

Copy link

valdean commented May 20, 2016

@coldnebo @Dayjo @Krellan @raveren thank you for all of the comments above. all helpful. this had been driving me crazy.

@jthomp

This comment has been minimized.

Copy link

jthomp commented Jun 3, 2016

Exactly what I was looking for. Thanks!

@mikedowd

This comment has been minimized.

Copy link

mikedowd commented Aug 18, 2016

Yes! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.