Mike McBride

Keyboard Shortcuts

Saturday, October 10, 2015

This is a two part post. Part one: why you should use keyboard shortcuts. Part two: common keyboard shortcuts and ones that I find super useful.

Almost anyone I work with can tell you how much I love keyboard shortcuts. Anytime I find myself doing something frequently, I check the settings or search to see if there's a keyboard shortcut for it. Keyboard shortcuts are a massive time saver. Anytime you can prevent yourself from having to move your hands from the keys to your mouse to perform an operation, you're saving time. It's why I like using vim mode in my code editor. With one keystroke, I can place the cursor at the end or beginning of the current line. I can tap d twice to delete the current line. I almost cringe now when I see people use the mouse to highlight an entire line just to delete it.

You get the point. Keyboard shortcuts are a big time saver, and you should be using them. Below are some super common keyboard shortcuts that you should definitely be using, followed by some more obscure ones that are my favorites.

Note: I am a Mac user, so some of these keyboard shortcuts will not apply to Windows/Linux. In many cases, you can substitute cmd for ctrl on those operating systems and get the same result.

Common Keyboard Shortcuts

These are fairly consistent across any program. Some may not apply depending on what the program is for, but these are generally the same everywhere.

  • cmd + a: select everything on the page
  • cmd + c: copy the highlighted text
  • cmd + x: cut the highlighted text (copies it to your clipboard)
  • cmd + v: paste the copied/cut text
  • cmd + z: undo the last operation
  • cmd + y: redo operation (only available after you've pressed undo)
  • cmd + b: bold (or un-bold) the highlighted text
  • cmd + i: italicize (or un-italicize) the highlighted text
  • cmd + o: open a file
  • cmd + n: new file
  • cmd + s: save file
  • cmd + p: print
  • cmd + left arrow: go to beginning of line
  • cmd + right arrow: go to end of line
  • cmd + up arrow: go to beginning of document
  • cmd + down arrow: go to end of document
  • cmd + plus: increase font size/zoom in (usually)
  • cmd + minus: decrease font size/zoom out (usually)

Code Editor Shortcuts

Applies to programs like Atom and Sublime Text

  • cmd + d: select multiple instances of the highlighted text
  • cmd + shift + l: if you have multiple lines selected, this puts a cursor on each line, allowing you to perform the same operation on multiple lines at once. Unbelievably useful. If you have a list of 300 words, one per line, you can turn that into an array with less than 10 keystrokes.
  • cmd + ,: This shortcut is available in a lot of programs. Usually opens your preferences/settings.
  • cmd + f: open find/replace panel for current file
  • cmd + shift + f: open project-wide find/replace panel
  • cmd + w: close the current tab

Browser Shortcuts

Many of these are the same across all browsers, but I use Chrome so I only guarantee they work in Chrome.

  • cmd + t: open new tab
  • cmd + n: open new window
  • cmd + shift + t: reopen the last closed tab. Life saver!
  • cmd + w: close the current tab
  • cmd + l: focus cursor in the url bar
  • cmd + r: reload the window
  • cmd + option + i: open Chrome dev tools

General Mac Shortcuts

  • cmd + m: minimize the current window
  • cmd + space: open Spotlight. From there you can search the web, open files or programs, use it as a calculator, etc.

Specific Program Shortcuts

These are shortcuts for specific programs on Mac.

Mail:

  • cmd + 1: go to inbox
  • cmd + n: new message
  • cmd + shift + d: send message
  • cmd + shift + n: get new mail (force Mail to check the server for messages)
  • cmd + r: reply
  • cmd + shift + r: reply all
  • cmd + shift + f: forward

Calendar:

  • cmd + t: go to Today
  • cmd + n: new event
  • cmd + 1: Day view
  • cmd + 2: Week view
  • cmd + 3: Month view
  • cmd + 4: Year view
  • cmd + left: previous (day/week/month/year depending on view)
  • cmd + right: next (day/week/month/year depending on view)

If you have any other shortcuts that you use a lot, I'd love to hear about it! Throw it in the comments below or hit me up on Twitter!