Shortcuts I use a lot

February 19, 2022

This guide is specific to MacOS because that’s what I know, and I can guarantee that these shortcuts work out of the box on a fresh install. A lot of them will work for Windows as well, replacing command with the Windows key or control.

For most developers, the practice of software development is, at a basic level, typing. There are other ways of interacting with the computer, such as voice recognition software, which can be especially useful for disabled people. I am not an expert in that, though, so I will focus on the keyboard.

While programming is typing, typing is not the point of programming. As such, many developers learn to interact efficiently with computers via keyboard shortcuts, bypassing the mouse as much as possible. This may seem like a marginal and pointless task at first (it did to me!), but building flow and fluency with the medium becomes more valuable over time.

If you are a new programmer, do not try to learn and incorporate all of these at once! It took years for me to add these to my repertoire, and I am still learning.

Here’s a quick glossary. The key combinations that make up a shortcut can be called chords, which I think sounds cool. And if holding down a key modifies the behavior of another key or chord, it is called a modifier key. The shift key is a modifier that everyone knows; it turns lower case letters into upper case letters.

I will start with a list of the most useful that you can get started with right away, and then delve into an exhaustive list. But first, go to keyboard settings and move the “key repeat” and “delay until repeat” sliders all the way to the right. This is one of the first things I do on a new Mac, and it automatically makes it feel ten times more responsive.

screenshot of key repeat and delay until repeat sliders

I use some custom shortcuts for specific programming tasks that I will not list here. I tend to prefer doing shortcuts with just my left hand, so sometimes I’ll remap an existing shortcut to enable that. For example, cmd + p in VSCode opens the fuzzy finder, but I’ve remapped it to cmd + t.

Note that oftentimes, adding shift to a chord will perform the opposite of the normal action. For example, cmd + tab selects the next application, and cmd + shift + tab selects the previous application. I won’t list this shift modifier exhaustively.

Most useful shortcuts (start here!)

ShortcutDescription
cmd + tabSwitch apps. Hold down cmd and tap tab to keep moving.
cmd + spaceOpen Spotlight search
cmd + pOpen fuzzy finder in VSCode
up/down arrowMove through command history in terminal

Global shortcuts for MacOS

These work in the global MacOS context or in a majority of apps.

ShortcutDescription
cmd + tabSwitch apps. Hold down cmd and tap tab to keep moving.
cmd + tildeSwitch windows in current app
cmd + spaceOpen Spotlight search
cmd + wClose current window or tab
cmd + qQuit current application
cmd + +/-Zoom in/out
cmd + ,Open current app preferences or settings
cmd + shift + 4Take a screenshot of part of the screen

Terminal

I still don’t really know the difference between ctrl + d and ctrl + c, but mashing one or both will reliably end a process in terminal.

ShortcutDescription
ctrl + cEnd current program
ctrl + dEnd current program
ctrl + aMove cursor to beginning of the line
up/down arrowmove through command history
tabAutocomplete current file or command
cmd + tOpen new tab
cmd + shift + [Move one tab left
cmd + shift + ]Move one tab right

Text editing stuff

These work for most text editing contexts, like VSCode, SublimeText, Google Docs, or any old text box on a web page. They will not work in the terminal, vim, or emacs.

Note that holding shift while doing any cursor movement (word-by-word or line-by-line) will select as you go. This can be powerful for copying large blocks of text.

ShortcutDescription
shift + direction keyselect text in that direction
cmd + direction keymove the cursor all the way in that direction
option + left/right arrowmove one word to the left/right
cmd + aselect all the text
cmd + ccopy selection to clipboard
cmd + vpaste clipboard contents
cmd + zundo
cmd + ssave
cmd + ffind on page

The following are specific to VSCode and similar code editors.

ShortcutDescription
cmd + shift + z or cmd + yredo
cmd + dselect next instance of current selection
cmd + clickplace new cursor
cmd + shift + fopen global find
cmd + shift + eopen and close file tree sidebar
cmd + popen fuzzy finder

Browser

I could write a whole series of articles on the importance of tab navigation, including its role in accessibility and discoverability. In short, it’s very important and useful, but two of the main browsers have it disabled by default. Make sure you enable it!

  1. Safari

    Safari Preferences > Advanced > Press Tab to highlight each item on a webpage.

    While you’re in the advanced menu, select “Show full website address” and “Show Develop menu in menu bar”. This will make web development in Safari much easier.

  2. Firefox

    System Preferences > Keyboard > Shortcuts > Use keyboard navigation to move focus between controls (at the bottom of the window)

  3. Chrome

    Tab navigation is enabled by default in Chrome.

ShortcutDescription
tabfocus next focusable element (see note above)
cmd + topen new tab
cmd + wclose current tab
cmd + shift + treopen most recently closed tab
cmd + lfocus URL bar
cmd + shift + [move one tab left
cmd + shift + ]move one tab right
cmd + left/right arrowgo back/forward
cmd + option + iopen/close dev tools
escape (in dev tools)open/close JS console

Miscellaneous

Here are a last few useful tidbits for specific apps.

ShortcutDescription
shift + enterIn gmail and other messaging services send current message
tIn a GitHub repo, open file finder

Profile picture

I'm Vincent, a web developer in San Diego. I eat a lot of pasta. My pronouns are he/him.
Here's my Github profile.
Here's my old archived blog.