Skip to content

Instantly share code, notes, and snippets.

@harryjubb
Forked from lornajane/mac.md
Created February 15, 2018 17:55
Show Gist options
  • Save harryjubb/269f9b72216481c110edc516d3c25cdd to your computer and use it in GitHub Desktop.
Save harryjubb/269f9b72216481c110edc516d3c25cdd to your computer and use it in GitHub Desktop.
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.

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