DEV Community

Arina Nasri
Arina Nasri

Posted on

Mac Keyboard Shortcuts Every Developer Should Know

While doing pair work in class, time and time again my partner will be like "Arina, you know there's a keyboard shortcut for that, right?" and no, I did not know there was a keyboard shortcut for that, but I wish I did because why did I just scroll through 300 lines of code in order to highlight it when I could've just used command-a?

Keyboard shortcuts are essential in time efficiency and having them memorized can really make coding a whole lot easier. If you're anything like me and are uneducated about what keyboard shortcuts are most helpful while coding, this article is for you!

What keys should you be familiar with?
On mac, the keys that are used in every shortcut includes a combo of one or multiple of these + a letter of some sort.
Command (or Cmd) ⌘
Shift ⇧
Option (or Alt) ⌥
Control (or Ctrl) ⌃
Caps Lock ⇪
Fn

Common Shortcuts Everyone Should Know
Command-X: Cuts out the selected item
Command-C: Copies the item
Command-V: Pastes the item
Command-Z: Undo (which is really important if you're typo-prone like me)
Shift-Command-Z: Redo, reverses the undo command
Command-A: Select all items
Command-F: Find items in document
Command-G: Used after command-f to find the next item that matches it if there are multiple
Command-H: Hide the window you are currently on
If you want to hide all other windows besides the one you're on, use Option-Command-H
Command-M: Minimize window to the dock
If you want to minimize all windows, use Option-Command-M
Command-S: Saves current document (Super important if you're not using autosave on your coding application!!)
Command-T: Open a new tab
Command-W: Close the tab you're on
If you want to close all tabs, use Option-Window-T
Option-Command-Esc: Force quit an app
Control-Command-F: Makes the app full screen

Navigating Apps
Command-Tab: Switches to the next most recently used app among your open apps
Control-Tab: Move forward through tabs
Control-Shift-Tab: Move backward through tabs

Text Navigation Shortcuts
Command-Left Arrow: Jump to beginning of a line
Command-Right Arrow: Jump to end of a line
Option-Left Arrow: Jump to beginning of current word
Option-Right Arrow: Jump to end of current word
Command-Up Arrow: Jump to beginning of all text
Command-Down Arrow: Jump to end of all text
Adding shift to any of these also allows you to highlight said text

VSCode Specific Shortcuts That Saved My Life
Option-Z: If you use split screen on VSCode with another app, this will wrap the text so that you can read every line of code without needing to scroll
Control-Shift-P: Opens up command palette
Control-Alt-Up/Down Arrow: Multiple cursors
Control-Shift-K: Delete a line
Shift-Alt-Up/Down Arrow: Creates a copy of the current line up or down the current line
Control-B: Opens up sidebar
Control-P: Search file
Control-`: Toggles terminal

Hopefully these shortcuts help you in your coding journey!

Sources
https://support.apple.com/en-us/HT201236
https://www.elementalidad.com/2017-11-06-keyboard-shortcuts
https://www.xda-developers.com/keyboard-shortcuts-mac/
https://www.wearedevelopers.com/magazine/vs-code-shortcuts

Top comments (0)