↓ Skip to main content

Keyboard Shortcuts MacOS Terminal

Keyboard Shortcuts for Programmers on a Mac: Terminal, Vim, VS Code and Chrome DevTools

The Mac keyboard shortcuts I use as a programmer, checked against each app's docs: macOS windows and Spaces, Terminal, Vim, VS Code, Chrome DevTools and Slack.

Keyboard Shortcuts for Programmers on a Mac: Terminal, Vim, VS Code and Chrome DevTools

These are the keyboard shortcuts I actually use as a programmer on a Mac: moving between windows and Spaces in macOS, Terminal, Vim, VS Code, Chrome DevTools and Slack. Nothing exotic, just the ones that have stuck. They’re all default bindings, checked against each app’s own documentation, so if you’ve remapped keys yours may differ. On many Mac keyboards the top row does brightness and volume, so for anything with an F key you may need to hold fn as well.

Mac
#

  • ctrl + ← / → — move between Spaces (desktops)
  • ctrl + ↑ — open Mission Control
  • cmd + tab — switch between apps
  • cmd + ` — switch between windows of the app you’re in
  • ctrl + cmd + f — toggle full screen, in apps that support it
  • cmd + w — close the front window (option + cmd + w closes all of the app’s windows)

Vim
#

  • vimtutor — Vim’s built-in tutorial, run it straight from your shell
  • v — visual mode, selecting by character
  • V — visual mode, selecting whole lines
  • ctrl + v — visual block mode, selecting a rectangle of columns
  • y — yank (copy) the selection

Terminal
#

  • sudo !! — re-run the last command with sudo (that’s the shell’s history expansion, so it works in zsh or bash in any terminal app)
  • cmd + t — new tab
  • cmd + n — new window
  • cmd + w — close the tab; shift + cmd + w closes the window
  • ctrl + tab / ctrl + shift + tab — next / previous tab
  • cmd + d — split the window into two panes
  • shift + cmd + d — close the split pane

VS Code
#

  • cmd + p — Quick Open: jump to any file by typing part of its name
  • shift + cmd + p — the Command Palette (F1 works too)
  • cmd + d — add the next occurrence of the selection, so you can edit them all with multiple cursors
  • option + click — add a cursor where you click (option + cmd + ↑ / ↓ adds one above or below)
  • option + ↑ / ↓ — move the current line up or down
  • shift + option + ↑ / ↓ — copy the current line up or down
  • cmd + / — toggle a line comment
  • F12 — go to definition
  • ctrl + ` — show or hide the integrated terminal

Chrome DevTools
#

  • option + cmd + i — open DevTools on whichever panel you used last
  • option + cmd + j — open DevTools on the Console
  • shift + cmd + c — inspect element: click anything on the page to jump to it in the Elements panel
  • shift + cmd + p — with DevTools open, the Command Menu (type “screenshot”, for example)
  • shift + cmd + r — hard reload, fetching the page’s files again instead of using the cache

Slack
#

  • cmd + k — jump to a conversation: type part of a channel or person’s name and press Enter (in recent versions the same box searches too)
  • F6 — move focus to the next section (shift + F6 goes back)
  • cmd + / — see all of Slack’s shortcuts