Create a gist now

Instantly share code, notes, and snippets.

@lornajane /mac.md
Last active Nov 16, 2017

What would you like to do?
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
vim http://www.vim.org/ I cheated here since I've been a vim user for a decade. Absolutely excellent editor that I can drive entirely from the keyboard though, basically this is the tool that allows me to be a software developer.
chrome + vimium https://vimium.github.io/ Control your browser entirely from the keyboard. Awesome for productivity nuts as well as computer-crippled people :)
shortcat https://shortcatapp.com/ Game changer. I don't want to overstate this but this tool allows me to click on more or less anything on my screen. This is the app that means I don't have to find console-equivalent tools for everything I do, I can use a GUI tool just like you!
alfred https://www.alfredapp.com/ Powerful launcher of all the things. And that's underselling it
hyperswitch https://bahoom.com/hyperswitch Makes alt + tab work within a desktop space rather than cycling through all open applications
spectacle https://www.spectacleapp.com/ Moving windows around from the keyboard. I have no idea why this doesn't come out of the box but this tool helps a lot.
iterm2 https://www.iterm2.com/ Feels like a terminal and has bells and whistles that I may never master but I spent most of my time in a terminal so perhaps I should.
irssi + openurl https://irssi.org/ and https://github.com/wertarbyte/irssi-scripts/blob/master/openurl.pl Most open source communities use IRC and so I spend a lot of time there. Irssi is a fabulous text-based IRC client that I've been using for years, and the openurl plugin lets me "click" on links so they open in my browser. This combination is MUCH easier than say slack or equivalents since I have a choice of clients and can script those clients.

General Shortcuts

Cmd + , (comma) to access preferences for the current app

Cmd + F2 focuses the top menu bar (you can turn off the machine from here)

Cmd + F3 focuses the dock

related: you probably want to turn off Ctrl + F1 which enables and disables the above! Look in the keyboard settings.

Lock the screen: Ctrl + Shift + eject/power or say "lock" to Alfred.

Move cursor to the top of a long list: Alt + up

Delete a file in finder: Cmd + backspace

Spaces

These are a pain to set up but I love them because it means I'm looking at fewer apps on one screen and it's easier to jump to the one I want without a lot of Cmd + tab to switch between applications. To configure:

  1. Go to "Mission Control" using Ctrl + up

  2. Hover your mouse at the top of the screen (yes, I do have a mouse, I just had to go and find it out of a cupboard) and it will unfold to show a bar where you can add as many spaces as you like. Check the options in "System Preferences" -> "Mission Control" to decide whether you want this per screen or not. Mine are not, the space spans both monitors.

You can move between spaces with Ctrl + left/right or there are keyboard shortcuts to enable via the keyboard settings area which enable going to a specific space by number Ctrl + 1 etc. This probably is more useful if you don't allow the mac to re-order your spaces as it pleases (this is a setting, I like mine to stay where I put them but YMMV).

Apps

Switching windows within an app Cmd + backtick.

In iterm2, also press Cmd + Alt + [number] where the number is displayed in the window bar. For switching between tabs, you can use Cmd + number - this also works in Chrome. For other apps try Cmd + Shift + ] or [.

Alfred

Alt + space to run any program. Alfred can do a hundred more things than this, well worth more research!

Shortcat

Shortcat might be the killer app for me on OS X. It can "see" and make "clickable" more or less any control in an application, including the content. To use:

  1. Type Cmd + Shift + space

  2. If the thing you want is labelled in words, start typing the words or the first letter of each word. If not, type a dot/period, which will show everything.

  3. If the thing you want is now highlighted in blue rather than yellow, press enter.

  4. If not, hold Ctrl and start typing the label. When the highlight is on the thing you want, press enter.

Note that you will need to allow Shortcat some accessibility permissions to run. The installation process will prompt you or you can find it in "System Settings" -> "Privacy" -> "Accessibility"

Vimium

I have been using Chrome for ages with a hacked version of an old accessibility plugin; I just added vimium because I needed something to use on the day I got my new mac. And ... it's fabulous, I'm now using it everywhere :) If you're not familiar with it, it pops up a label on each clickable item in the viewable area, allowing you to click links, focus fields, etc.

The help file is really helpful but here are the commands I'm using the most:

To trigger the plugin:

  • f to open the thing you then click on in the same window
  • Shift + f to open the think you click on in a new window
  • Alt + f to open more than one thing in a new window (useful on search results where you want to open a few tabs of results)

Just press escape to get rid of the labels.

Magic extra feature: you can select text from a webpage using Vimium (I've spent a decade retyping the content I want between one window and another, this is basically incredible). Just start searching for the start of the string you want, press return when you've typed enough search string and if necessary press n a few times to get to the correct instance of what you wanted. Vimium highlights what you typed but then you can hold down shift and highlight as much more content as you want, and copy!! Look out that Home and End don't do as I expected, try alt+arrow or cmd+arrow while holding shift.

Site-specific Config for Vimium

Any sites that have keyboard shortcuts are pretty awful for keyboard users I'm afraid! I have some tools where I do use the keyboard shortcuts in the site itself rather than from vimium and for these sites, you can add an exclusion. Vimium's icon in your browser will default to letting you add exclusions for the current site - use * to turn it off completely for whatever page you are on.

Google mail exclusions: ?jknpxercgils#uldf (press shift + f to open links)

Google calendar exclusions: nxptm

The comments moderation page on my wordpress blog (/wp-admin/edit-comments.php): jkasd

https?://localhost:8000/* (this is where reveal.js is served from, sometimes is annoying if I serve something else on this port though!) fb

Spectacle

App to move your windows around on the screen. It can put them in corners, in half the screen, on the other screen, or whatever. If it could put them onto another space as well, this would be perfect. As it is, it's pretty damn good and I love it (I had some built-in stuff and some madcap scripts to do these things on Ubuntu). Install it, set it to run on boot and then:

  • Window to other screen: Ctrl + Alt + Cmd + left/right super useful when demoing with tiled desktops
  • Window fullscreen (normal fullscreen, not mac fullscreen) Alt + Cmd + f
  • Window fills half of screen Alt + Cmd + arrow (arrow towards the long edge you want your window on)
  • Undo what you just did to your window: Alt + Cmd + z

This app is quite awesome and I need to get my muscle memory improved!

HyperSwitch

This makes Alt + Tab behaviour a little less weird, especially with spaces in play because you can set a preference to say that it should include windows from both screens but not from other spaces. This means that I use the Cmd + number shortcuts to get to a space, then Alt + tab to the app I want. With a small number of apps on each space, it's very manageable and this approach works well for me. I do have a bit of a habit with a lot of iterm tabs and tabs/buffers in vim as well but it does work, honest!

Hyperswitch can also often get windows that standard Cmd + tab can't see, and it doesn't interfere with it so you can continue to use both if you wish.

wturrell commented Jul 8, 2016

I'm hoping the ones I've listed below are all on by default and also not any I've manually reassigned. Use the Keyboard section in System Preferences (cmd + F to search!) to browse everything available and enable/disable/change shortcuts.

(note the alt key is referred to as 'option' / 'opt' in all Mac documentation)

(everyone asks this first): opt + 3

sleep opt + cmd + eject
shutdown window (choice of restart, sleep, shutdown) ctrl + eject
hide current window cmd + h
(more usefully) hide everything but current window opt + cmd + h
when app switching with cmd + tab: you may find cmd + . an easier way to dismiss the window than cmd + esc

search all menu commands in any app - start typing any part of the menu text (this is a crucial one and will save you a lot of time, for example, when you can't remember the exact keyboard shortcut, or it's too fiddly to type – Photoshop save for web… – or you want to repeat the menu item you used last): shift + cmd + ?

Finder - go to various directories, Downloads opt + cmd + L and Applications cmd + shift + A are the ones I use most commonly (for others see Go menu)

After a while you may start building up Favorites by dragging directories into the left-hand menu. However there's no way to get to these with keyboard shortcuts. Workaround by creating a shortcut directory with aliases (works quite well)

finder - go to parent directory: cmd + up
finder - rename: return
switching tabs in finder + terminal + iTerm2 + Firefox + Chrome +… : shift + cmd + [ or ]

Quickview in Finder: space
Quickview in Finder, but open full-screen: opt + space
(Note you can download Quickview extensions for things like Markdown)
(shade multiple items and launch quickview for a slideshow/carousel)

empty trash (you'll get confirmation dialog, or if already empty nothing with happen): shift + cmd + backspace
There is a modifier to delete files without sending them to the trash first, but wouldn't recommend it.

choose don't save in a save document dialog: cmd + d

finder - move files you've already copied to clipboard (i.e. perform a cut after you've already copied some files): cmd + opt + v

switching between multiple windows in same app (typically web browser): `cmd +``

full screen screenshot (saved to desktop): shift + cmd + F3 (F4 to take one where you select area with mouse)

focus on the icons in the menubar (top right): ctrl + F8 (then use arrow keys)

turn zoom on/off: opt + cmd + 8 (then cmd + two finger drag up/down on trackpad to zoom in/out)

Vimium (and VimFx in Firefox) - goto homepage (root directory) of current site: gU

Google Mail - deleting messages: you're supposed to be able to mark them with x then use #, but it doesn't work for anyone on Mac for some reason. Enable the Custom Keyboard Shortcuts in Settings > Labs and assign £ instead.

euperia commented Jul 12, 2016

Google Mail:
select all - shift + 8 + a
select all unread - shift + 8 + u
select all read - shift + 8 + r

gdsmith commented Jul 15, 2016

+1 for the ++/ searching menu items. Also useful to know is the "App shortcuts" section in the Keyboard System Preferences. Basically you can add/change/disable keyboard shortcuts assigned in apps in here.

Another couple of Finder keys
++G to open a dialog so you can enter a path to get to that folder
+K for connecting to a host on your network

Text searching:
+F opens find dialog
+G search again
+E marks selection for find (eg +E then +G will find the next instance of the selected word) – this works globally so mark for find in one app and +TAB to another app and +G will find in that app – the reason that I find it nearly impossible to switch to any text editor that doesn't support these.

General shortcuts:
++ESC opens Force Quit dialog
+CTRL+SPACE opens Emoji / Symbol dialog

Screen capture:
++3 captures full screen
++4 captures selection
(with Dropbox installed online links to these get automatically populated in your clipboard)

Fantastical lets you add events and reminders using natural language.

Would also say that Quicksilver is worth investigating as a free and more than capable alternative to Alfred.

Wanted to bring XEasyMotion to your attention! It lets you emulate clicking by splitting the screen until you get what you want, choosing halves of the screen at a time using h, j, k, l.

It's based on the keynav project.

pekcheey commented Mar 9, 2017

wow. I'm learning some new ways to keyboarding here. I just want to add on that shift-it is a good windows management app that I'm using. also you ought to have a section for commands such as "pmset displaysleepnow"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment