Ask HN: The most useful Mac keyboard shortcuts?

122 points by yesenadam ↗ HN
Ones that most people don't know about, that you actually regularly use. Thank you!

Edit: "Not a shortcut exactly..." tips are most welcome too.

139 comments

[ 2.8 ms ] story [ 175 ms ] thread
Not exactly a shortcut, but https://contexts.co/ completely changes Cmd+Tab; without it I would be materially less productive
In Finder, Command-Shift-. (period / full stop) will show hidden files.
Option-clicking on things, e.g. the wifi status symbol, will give you more detailed/different information.
If you hold down option in Xcode while cleaning the build from the menu, "Clean Build" turns into "Clean Build Folder" which applies to all targets.
Not a shortcut exactly, but remap caps lock to ctrl.

So much easier in terminal and for using shortcuts like ctrl-A & ctrl-E for beginning and end of line, etc.

If you have a touchbar remap it to esc. I swapped my MBP for an air but kept the remapping.
with Karabiner, you can make it so that a tap of caps lock emits an escape, while still being able to use it as a ctrl modifier when pressed in conjunction with other keys: https://pqrs.org/osx/karabiner/document.html#configuration-c...
I don’t think karabiner elements supports that and I believe that the old karabiner no longer works with current versions of Mac OS
The latest version of Elements has supported this for several months, if not longer (I think they'd made it work for High Sierra at least, but I could be wrong about the exact timing.)

I use it for both Caps Lock -> Escape/Control and Return -> Return/Control and it's indispensible.

Or to esc. Saves my vim pinky a lot of grief.
> Or to esc. Saves my vim pinky a lot of grief.

FWIW, Ctrl-[ emits the ASCII code for ESC. So you can save that 'vim pinky' and have the remainder of control codes available to you as well :-).

I forget what the tool was, but I recall someone mentioning they mapped CapsLock to ESC when tapped, and to Ctrl when held.
It's Karabiner Elements on the Mac.

On Linux you can get it to do the same thing with a combination of xmodmap, setxkbmap and xcape (but it's fiddly) and on Windows with AutoHotkey (but it's fiddly) — neither are as easy to use as Karabiner Elements, but they do work.

I found mapping Caps to Ctrl caused too much RSI.

It's better to use a full size keyboard and use two hands for keyboard combos, e.g. for Ctrl+A use right Ctrl, for Ctrl+N use left Ctrl, for Ctrl+E use right control. Takes a little while to master but it puts much less pressure on your fingers.

Mapping Caps to Esc is a good choice though.

It causes more RSI than using ^ in its regular spot?

I like your Esc idea though. I know someone that remaps it to esc when pressed alone and ctrl when chorded.

It also makes it easy to use Ctrl-[ instead of reaching for ESC, which as a heavy Spacemacs and iTerm user is a lifesaver for me.
Always the first thing I do on any new system. Caps lock is the most useless key in the most prime real estate.
Not a shortcut exactly, but get some app that adds shortcuts to snap the current window to various presets. I use Spectacle, but there are several.
I use Magnet, which comes with very nice KB shortcuts for window manipulation. It adds on the one feature from Windows that I missed on macOS.
Another recommendation for Magnet. Using an ultrawide with my MBP it makes snapping windows around the screen really smooth and a key part of the workflow.
I use BetterSnapTool. Gives me the same kind of "windows key + direction" usage that I came to love when I was a windows developer.
Shift+Cmd+4 for screenshot(s)
Wish this was easier to remember. I don’t do many screenshots yet I have ctrl/alt print screen burned in my brain and have to google this one every damn time
(joke ..) It's easy, just remember to add +1 from "Cmd Shift 3" .. the whole-screen screenshots shortcut.

(seriously) Cmd Shift 4 also has AFTERTOUCH - so do the command, draw out the grey capture window, and keep holding the mouse button WHILE trying using different combinations of Ctrl, Option, and Shift. Allows you to resize your capture window.

Without the initial SHIFT dumps the file to the Desktop. With the SHIFT adds the screenshot to your clipboard.

+space to capture a single window.
Hold option to remove the shadow
Press space afterward to screenshot a particular window with an added drop shadow.
Shift + Cmd + Ctrl + 4 for copying the screenshot into clipboard
OMG. This is awesome. I always open the "Grab" program but this is exactly what I should have always known. Thank you!
Just to sum this all up and add some detail:

Shift-Cmd-3 will simultaneously capture a screenshot of ALL monitors connected to your system and put the files on the Desktop.

Shift-Cmd-4 will give you a cursor with which you can draw a rectangle of the area desired; if you then hit Space, however, the cursor changes to a camera icon which then allows you to click on any open window. That window will then be captured.

Shift-Cmd-5 pulls up a full set of screen capture controls with various options.

Cmd-space Type a few characters: start or switch to an app. Just hide the dock. Keeps your hands on keyboard and your eyes where you want them to be.

Control-cmd-F makes most apps full screen (or toggles back)

^k, ^y, etc...standard text widgets accept basic Emacs commands.

Four finger swipe on keyboard slides between full screen apps (or spaces)
You mean on a trackpad?
Yes, sorry, that’s what I meant.
Cmd-Space for me is the most powerful one! It makes life so much easier, and unlike the windows key, it's all front and center on your screen and easier to read.
(comment deleted)
The one I remember best is Control-OpenApple-Reset.
Which is all very well, but Macs have never had an OpenApple or Reset key (the Command key used to have an Apple symbol on it, but now just has the cloverleaf symbol).

Suggests your experience with Apple computers dates back at least to the '80s! :-D

That causes a reboot on an Apple IIGS!
Spectacle (https://github.com/eczarny/spectacle#keyboard-shortcuts) will change your life with better/faster window management.

And Karabiner Elements (https://github.com/tekezo/Karabiner-Elements) to remap keys to something more useful (who uses Caps Lock anymore?)

I use Karabiner to map symbols to the home row with a Caps Lock modifier.

It's really nice to use k for "(" and l for ")". I don't have to reach up two rows.

FWIW, I use the Double Use Shift for parantheses. Tap left Shift for (, tap right Shift for ), and shift works as usual for normal typing and shortcuts. Karabiner is really an essential tool for me, especially this shortcut.
Oh wow. That's a really good one. Never thought about shift taps.
Iirc you can remap capslock in OS X settings, don't need an addon for that. Thought I'm sure Elements does a lot more than just that.
(comment deleted)
Spectacle is great but abandoned. It hasn't been updated in years. Bug reports and PRs are piling up.

It looks like someone else is currently working on a Swift rewrite. https://github.com/rxhanson/Rectangle

TIL. I should check out Rectangle:

> Spectacle used it's own keyboard shortcut recorder, while Rectangle uses MASShortcut [1], a well maintained open source library for shortcut recording in macOS apps. This cuts down dramatically on the number of bugs that were only in Spectacle because of the custom shortcut recorder.

[1] https://github.com/shpakovski/MASShortcut

Cmd up arrow and cmd down arrow for navigating through folders and opening docs. I miss this so much when I using Windows.
Cmd + right or left arrow for home and end keys. I miss it so much on windows.
Command-e, put the selected text on the find clipboard.

Then command-e, command-g (find next) will search for the selected text without sacrificing the copy/paste clipboard.

Also, the find clipboard is shared between apps, so you can command-e in Safari, then command-g in Xcode.

Get Alfred. Clipboard history will change your life.
I've been using Copy'em Paste but Alfred looks like a beast.
It is a beast. If you are a dev you can extend it with scripts.
And eject a disk from the desktop.
Note, cmd+e seems to be a safari thing; no such luck in chrome. I just cmd+f again.
In chrome, cmd+e updates the search text, cmd+g starts the search and iterates through results, shift+cmd+g goes backward through the results
> cmd+e seems to be a safari thing

Works fine on Firefox. I'd say breaking it is a Chrome thing.

Actually, doesn't work for me in Firefox (68.0.1)
Cmd+shift+/ - brings up help search to search through menu items. Huge feature to me over windows, Linux-based desktop environments.

Not exactly a shortcut, but I once made a gesture-driven shortcut app (https://thimblemac.com) - it’s been on hiatus the past couple years but have been wondering if there’s value in it for programming work contexts.

Holy, this is really good. I have been using an extension on alfred for this purpose, now I can get rid of it. Thanks!
Cmd+shift+/ doesn't work in any app I'm running. Did you set that up yourself?
It works in every single app that I'm running.

Did you remap that key combo?

Nope, just checked my keyboard shortcuts and it's not listed.
ditto. no worky in chrome, vs code. In slack, it brings up emoji (which is pretty neat!). In Notes, it centers text.
OP grandparent meant CMD-?, and ? happens to be SHIFT-/ on US and international keyboards.
CMD + `/~ to switch between windows of the same app. Or if you're in the CMD Tab switcher will cycle through the list backwards.
cntrl+a: go to start of a line

cntrl+p: go up one line

cntrl+n: go down one line

cntrl+k: cut line proceeding cursor

cntrl+f: forward one char

cntrl+b: back one char

These work everywhere you can type text on Mac: including in this HN text box, in the url bar, etc. I absolutely love these shortcuts...

and cntrl+e: end of line

aka Emacs keybinds.

IIRC, these are enabled by default if the text view is a standard NS* text view (don't recall the actual class). It's always a bit of a surprise when I find a window where these don't work, and that's a good indication that someone has implemented their own class for the text view. Little nugget holdover from those Unix-loving NeXT devs.
I was wondering why these worked everywhere. I had no idea it was a mac feature.
You missed the best one, ctrl+t: swap the left and right characters adjacent to cursor. Fixes about 90% of typos.

> These work everywhere you can type text on Mac

Supposedly they even work on iOS if you plug in a keyboard, which is pretty unexpected if you think about it.

Command-~ to switch between windows of the current program.
Shift-option-command-v: paste text without any formatting as opposed to simply using command-v
For all those with Touch Bars - remap Caps Lock to be the Escape key
Alfred 3's Clipboard History.

I map it cmd-shift-v and I can bounce between all of my most recent clipboards. Saves so much time.

Alfred is amazing. I just buy every new version even if I don’t use any of the new features to give money to the dev.
Option (or Alt) ⌥ + Down Arrow in Finder. Goes into selected directory.
You sure you don't mean Command?
⌥↑ goes up in turn, which is super useful if you're in a file picker and the back button is disabled
⌘^q to lock the screen
that quits my active window. I have to cmd+ctrl+q
^ is the symbol for ctrl, sorry for the inconvenience
Vimium browser extension.

Key commands generated to follow any link on the page. It makes browsing really efficient.

Command-<down arrow> to open the selected item in finder. A small convenience, but makes my finder usage completely mouse free.
Didn't see Command + Shift + G mentioned when in Finder.

"Go to the folder:"

FWIW tab completion works in that dialog.