On of my developers recently switched to a Mac, and was wondering how to move the insertion point to the beginning and end of a line on the Mac (OSX doesn't support home/end keys in the same way as Windows). I thought with so many developers switching to Apple hardware, it would be useful to post a quick run-down on the awesome text shortcuts in OSX. This is hardly an exhaustive list, but these are the ones I use regularly (brackets describe behaviour for multiple presses):
- opt-left: beginning of current word (beginning of previous word)
- opt-right: end of current word (end of next word)
- opt-up: beginning of paragraph (beginning of previous paragraph)
- opt-down: end of paragraph (end of next paragraph)
- opt-delete: delete to beginning of word (delete previous word)
- opt-forward del: delete to end of word (delete next word)
- cmd-left: move to beginning of line
- cmd-right: move to end of line
- cmd-up: beginning of document
- cmd-down: end of document
- shift with any of the above: select text. For example, cmd-opt-right selects to end of the word.
- you can also chain this, so cmd-shift-right, then shift-left would select to the end of the line, then deselect the last character (ex. leaving the semi-colon).
These last two are not really shortcuts, but the lack of support for them drives me nuts in Windows:
- down arrow on last line of text (including 1 line text fields): end of line
- up arrow on first line of text (including 1 line text fields): beginning of line
It's worth noting that text shortcuts are much more consistent in OS X than on Windows. Virtually every app supports the same shortcuts, including things like cmd-a for select all. I hate it in XP when I want to select all the text in a dialog so I hit ctrl-a and nothing happens. You only ever encounter this in bad ports or the odd java app on Mac.
You might also want to check out Textpander, which is a great little utility that will automagically replace text shortcuts in any textfield with expanded text (or even images, etc) as you type. For example, I have it set to replace "uv\" with "public var ". Unfortunately it was purchased by another company who is overcharging for it imho ($29.99). If you hunt around a bit though, you can find a copy of the original free version.
Here's a list of other OSX shortcuts that could be useful.
Comments (20)
great post, also point out holding shift higlites which i use all the time..... i.e.
shift + alt + left ... highlites the word to the left
shift + alt + right .. highlites the word to the right
(my two favourite shortcuts of all time... mainly because they work on text in every app)
and up and down highlites the paragraph from cursor position etc..
Posted by: thatblokemike at July 14, 2006 11:19 AMURL: http://www.thatblokemike.com
Hey, cool, your tips came in at the right time!
Posted by: Brajeshwar at July 14, 2006 11:26 AMURL: http://www.brajeshwar.com/
Mike - already in the list: "shift with any of the above". Reorganized a bit to make it stand out. Definitely one of my favourites too - super useful for jumping through method params and editing them. :)
Posted by: Grant Skinner at July 14, 2006 11:32 AMURL: http://gskinner.com/
wow thats freaky, just yesterday i was thinking to myself if there was a way to jump to the next word instead of to the end of the line.
since you mentioned Textpander, i jsut wanted to bring up that textmate has support for that kind of stuff too (they call it Tab Trigger). I type 'getset'-tab and get getter/setter methods with the private var in place, and tab stops quickly fill out the necessary parts of the methods. its pretty awesome.
Posted by: flashape at July 14, 2006 11:42 AMURL: http://www.visible-form.com/blog
I'm right there with you, wishing I had as much keyboard-shortcut access on Windows as I do on Mac..... Some noteworthy OS X apps for which these shortcuts do not work:
Dreamweaver: Cmd-* and Opt-* behave the same (skip whole chunks at a time); must switch to HOME and END (Cmd-Home and Cmd-End to jump to beginning/end of the entire document).
Illustrator & Photoshop: Opt-right and Opt-left do not jump from word to word but adjust the kerning instead. Switch to Cmd-* and Home/End as with Dreamweaver.
Flash (input text for compiled SWFs): Cmd-* and Opt-* do not work, only Home and End are available (perhaps I am nitpicking here).
Posted by: Noah Dziobecki at July 14, 2006 04:22 PMURL: http://www.dzignspace.com
When you discover these shortcuts, you definitely gain time, especially while coding or debugging. :)
Posted by: glorb at July 16, 2006 11:23 PMURL: http://glorbox.com
Sweet. I knew stumbled on a couple of them my self. It's good to know all of them them now.!
Posted by: Jonathan Spooner at July 19, 2006 10:39 AMURL: http://www.jonathanspooner.com
Weird - I'm the other way round... Haven't "switched" and whenever I need to use someone's Mac for something I find myself getting really frustrated that "Home" and "End" and other text navigation shortcuts I'm used to don't work like I'm expecting... Hopefully this will help to ease the pain!
Posted by: Kelvin Luck at July 21, 2006 12:25 PMURL: http://kelvinluck.com
Very useful - I was especially missing the goto start/end of line ones, coming from Windows.
Posted by: Edwin van Rijkom at July 30, 2006 01:39 PMURL: http://www.vanrijkom.org
This is hilarious (and useful).
I just bought a MacBook and love every feature. But the home/end difference (and Control + Arrow Key) have been driving me nuts! Oh well. A small inconvenience to overcome...
Thanks for the guide!
Posted by: Kyle at August 13, 2006 03:56 PMURL: http://kylefox.net
hello,
Posted by: brett august at August 29, 2007 05:36 AMcommand + up to get to the beginning of the document doesn't work for me in Word for Mac. Does anybody know how to go to the beginning/end of a document in Word on a Mac.
thanks,
brett
URL:
Hi, Brett
I was wondering the same thing myself: how to get to the beginning and end of a document in Word for Mac...
My search brought me to this page. Then, when I was about to give up, I found it.
Try Function-Command-Home and Function-Command-End.
Woiks for me!
Posted by: jwc at December 12, 2007 04:03 PMjwc
URL:
How do I go to the end or the beginning of a document in Word for Mac on a Mac Book laptop? (There are no end or home keys.)
Posted by: jb at February 26, 2008 02:29 PMURL:
In MacBook, try
Fn + Cmd + right arrow (end) or left arrow (home)
Posted by: jhopkin at April 7, 2008 10:37 AMURL:
Super! It works. Thanks.
Posted by: jb at April 8, 2008 04:23 PMURL:
As a longtime DOS and later Windows user I was dumbfounded at first as well. But I do have to say now adjusting to these hot-keys, they are more intuitive and make more sense for text editing..
Thanks for the guide.
Posted by: kibbled_bits at July 5, 2008 03:45 PMURL:
On iPages 08, for HOME button, you can try Cntrl + command + left arrow key, whereas for the END button, you have Cntrl + command + right arrow key.
If you are using TextEdit or other basic word processor, then you can use Control + Right button for END and Control + Left button for HOME.
Posted by: Samir at August 13, 2008 09:24 PMURL:
Does anyone know if you can change these shortcuts so that the command key acts in place of the option key? I really hate having to switch off.
Posted by: josh at October 7, 2008 02:43 PMURL:
Thanks, jhopkin, for the End and Home commands for the MacBook laptop. The instructions that say to hit "End" or "Home" when they don't exist were dumbfounding me. :)
Posted by: I-Cat at November 21, 2008 03:47 PMURL:
Thanks for the useful article.
I just switched to Mac from years of Windows. All of the shortcuts you mention are available on Windows and pretty consistently applied, IMO. The home/end keys move the cursor to the begin/end of a line, like PgUp/PgDown do for pages, and the shift key combo does selection with them. Home/End on Macs go to the beginning/end of the document --- how often does one do that in comparison to begin/end of line? Not a great design choice.
I just got a beautiful new 17" MacBook Pro, but the thing I really miss is the simplicity of text selection on Windows. On the Mac, I've got to press 3 keys instead of 2, and sadly things like GMail don't support command-shift-right/left selection.
Posted by: aneil at May 20, 2009 10:06 AMURL: