Mac Keyboard Shortcuts Every Developer Should Know
Published: 2024-04-13 20:51:18

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