Cocoa and Objective-C: Up and Running (by me) is now available from O'Reilly.

Ridiculously Useful Shortcuts Easily Forgotten

There are some truly invaluable keyboard shortcuts in Mac OS X and related apps that can get lost in the noise. Here a few I found or was reminded about recently.

  1. Space goes down one page in Safari. Shift-Space goes one page up.

  2. Command-Shift-A summons the Applications folder in the Finder. Command-Shift-U brings up Utilities.

  3. Control-Command-D will bring up a floating dictionary panel over any word in a standard Cocoa NSText-based view or WebView.

  4. Option-Esc will offer autocompletion in just about any standard Cocoa text view. I'm not sure exactly how the list is constructed, but most of it seems to come from the built-in dictionary (see the Daring Fireball post about this)

  5. A subset of Unix-style key bindings work in many text contexts. Control-E goes to the end of a line, Control-A goes to the beginning, and so on.

  6. Option-Command-H hides all apps except the frontmost one.


There's a plethora of keyboard fun available by clicking a few checkboxes in System Preferences → Keyboard & Mouse → Keyboard Shortcuts.

Keyboard and Mouse


Under the "Keyboard Navigation" group of shortcuts, there are two particularly interesting tools. The first is Control-F4, which allows you to cycle through all visible windows, not just those in the current app (as with Command-tilde).

The really fancy trick is Dock focus with Control-F3. It's nice enough to be able to select an icon with the keyboard and activate it, but if you hold down Option and press the arrow keys you can re-arrange the icons at will. I can't explain why, but this is really fun to play with.

Also, if you activate full Keyboard Access in this same System Preferences pane, you can navigate through most onscreen controls with Tab.

Of course QuickSilver offers tricks far beyond all of this, though all of the above tips work out-of-the-box on any Mac.
Design Element
Ridiculously Useful Shortcuts Easily Forgotten
Posted Mar 31, 2007 — 25 comments below




 

Tomas Kolar — Mar 31, 07 3826

I use Mac OS X also because of sophisticated system of keyboard shortcuts that is mostly followed by third-party developers. But one thing I can't understand. Why is, by default, the same shortcut for Spotlight and switching between keyboard layouts (input sources).

Joachim Bengtsson — Mar 31, 07 3827

Underappreciated MacOS shortcut of the year: cmd-< and cmd-shift-> (on swedish keyboard, don't know what they are on us 'boards).

It annoys me to no end though that is cmd-< semi-broken; the window toggled away from is /sent to the back/ for some incomprehensible reason), while when you do cmd-shift->, it's not.

lone — Mar 31, 07 3828

Cmd+tab used to cycle between Dock icons of the open apps before 10.3 rather than having a panel in the middle of screen, which I liked more than the current behaviour (although I recognize its useful sides).

Henrik N — Mar 31, 07 3829

Some nice key-and-click shortcuts:

Opt+Cmd+click icon in dock: show that app, hide all others.

Cmd+click item in Spotlight results: Reveal it in Finder.

Marco Masser — Mar 31, 07 3830

And one more: Ctrl + F2 takes your focus to the menu bar at the top. By using the arrow keys and the enter key you can navigate in the menus. Additionally, after pressing enter on any of the items, you can press a letter key to hop to the first item in that list that starts with the letter pressed.

And by the way: the dictionary completion seems to pop up by just pressing Esc here, without the additional Option key.

Gareth — Mar 31, 07 3831

Most of these I didn't know. Really cool. Especially the dictionary and dock stuff.

Chris Ryland — Mar 31, 07 3832

One of my favorites, I don't think well-known, is bringing up the task list with command-Tab and then using the mouse to select an application. Much faster than tabbing through a list of 20 apps.

Another is quickly quitting the currently-selected app from the task list by typing Q while holding down the Command key (keeping the task list alive).

David Cairns — Mar 31, 07 3833

The reason you like rearranging the Dock icons with the keyboard:

it's like playing Bejeweled.

My favorite combo: command+option+D to toggle hiding the Dock. I prefer it visible, but sometimes my 15" powerbook just doesn't have the real estate I need.

Howard — Mar 31, 07 3834

#5 should be emacs-like keybindings (not unix-like) and they're available in cocoa text widgets. Moreso it's customizable and extensible by editing a text file. See info here.

Tim W. — Mar 31, 07 3835

ctrl-r in Terminal.app turns on command completion (exit session with esc or ctrl-c)

Scott Stevenson — Mar 31, 07 3836 Scotty the Leopard

@Howard: #5 should be emacs-like keybindings (not unix-like)
I know. I just didn't want to scare off non-emacs users.

Erling — Mar 31, 07 3837

A really usefull trick to quit applications fast is to press command+tab and then just command+q within the tab-menu for the applications you wish to quit . Much faster than quitting each individual program!

Andy Lee — Mar 31, 07 3838

Space and Shift-Space also page the current message up and down in Mail. NetNewsWire also uses the same convention -- maybe it's built into WebView?

Jacob Rus — Mar 31, 07 3841

Scott, I'm unimpressed with your blog's inability to accept unicode characters in comments, or to even accept html entities.

Beyond the aforementioned Cmd-E, I made (over a year ago) a nice list of all the default key bindings in Cocoa text fields. This includes things like the emacs bindings, plus a few more useful things. But it's of course very possible to make your own bindings if those are unsuitable.

Scott Stevenson — Mar 31, 07 3842 Scotty the Leopard

Scott, I'm unimpressed with your blog's inability to accept unicode characters in comments, or to even accept html entities
I'm sorry you feel that way. As I'm sure you understand, there's a lot of code to be written and some things fall by the wayside or nothing gets done. Realistically, only handful of comments have ever tried to use unicode. I will get to all of that stuff in order, but I have to focus my attention on the things that need the most attention.

Jacob Rus — Mar 31, 07 3857

Hey Scott,

I'm sorry you feel that way. As I'm sure you understand...

That comment maybe sounded a bit harsher than I intended. It was meant in a light and joking manner, not as serious criticism. The blog is great, as is all the other stuff you do.

Still though, Apple's nice clover symbol looks a lot better than "Cmd". ;)

Jon H — Apr 01, 07 3865

I just wish some of the more obscure shortcut symbols were explained somewhere. Somewhere easy to find.

For instance, in Terminal.app, the Command-diagonal-up-arrow (Scroll to top) and Command-diagonal-down-arrow (Scroll to bottom). What the heck are they?

(Amazingly, after years of befuddlement, I finally figured that out right as I was writing that. It's command-home and command-end. Not that there's anything to particularly link a diagonal arrow to those things. It almost looks like it means a mouse gesture.)

jon hendry — Apr 01, 07 3866

Rearranging the Dock is even more fun if you turn magnification on.

Jason — Apr 02, 07 3870

I was really happy when I found that using alt(option) + cursor-left and alt(option) + cursor-right would let me navigate word left and word right in any text entry area.

It was one of the shortcut's I thought I'd lose when I switched to the Mac recently, and one I can't do without.

Chinmoy — Apr 02, 07 3872

How about Command-Shift-3 for taking a quick screenshot (without invoking Grab and all) and Command-Shift-G to navigate to a directory using the keyboard..

dc — Apr 02, 07 3873

I also am a huge fan of the arrow-based text navigation keys.
Arrow keys: move cursor one unit in any direction
Option-arrow keys: move cursor one larger unit in any direction (left/right, word; up/down, paragraph)
Command-arrow keys: move cursor one huge unit in any direction (left/right, line; up/down, page).

Add shift to any of these to select as the cursor moves. Option-delete deletes the previous word (very, very, very handy); option-forward delete deletes the next word.

Now we just need LEAP keys :D

Juicymixx — Apr 04, 07 3877

for command line shortcuts in the terminal, if you use bash, then you can bind any key combo to any command using the command:
bind

so, I can (and do) bind commands and actions from common unix programs that I like to similiar shortcuts in terminal. For instance, I like the 'cut text' and 'uncut text' commands in nano/pico, so:

# give me remove/replace as in pico/nano
bind "\C-k":unix-line-discard ## CTRL-K to buffer a line
bind "\C-u":yank ## CTRL-U to paste in a line

Christopher Humphries — Apr 15, 07 3923

Wow! Nice to know. I am now still new to the Mac and much of this I was not aware of (still learning keybindings).

Thanks for posting!

Gand — May 07, 07 4061

(click or up/down arrow) + Enter to rename files.

Chris — Mar 23, 09 6652

Guessing this is more of the Unix style key bindings you mention in the post, found this at Cocoa Text System.

To Kill some text is basically the same as using the ‘Cut’ command, but in OS X uses a separate mechanism, that is localized to the current buffer. By default ‘Ctrl-k’ kills everything after the insertion point on the current line.

Yank is the analog of the ‘Paste’ command. By default, ‘Ctrl-y’ yanks back whatever was most recently killed.


Very handy, I'm sure!




 

Comments Temporarily Disabled

I had to temporarily disable comments due to spam. I'll re-enable them soon.




Technorati Profile
Copyright © Scott Stevenson 2004-2008