Introduction
This blog post will discuss the twenty-nine essential Visual Studio Code shortcuts to help Mac and Windows users be more productive in 2024.
In today’s fast-paced software development world, every second counts. That’s why developers are always looking for ways to boost their productivity and efficiency.
One of the most effective ways to do this is using keyboard shortcuts. For example, visual Studio Code (VSCode) is a popular code editor developers use to write, debug, and run code.
What Are VS Code Shortcuts?
Visual Studio Code (VSCode) shortcuts are keyboard combinations that allow users to perform various actions, such as editing code, navigating through code, managing files, folding and unfolding code, debugging, and customizing settings, quickly and efficiently without using a mouse.
These shortcuts are designed to save time and improve productivity for developers working in VSCode. They vary for Mac and Windows systems and can be customized to meet the user’s individual needs.
How Do You Use VS Code Shortcuts?
To use Visual Studio Code (VSCode) shortcuts, press the specified key combination on your keyboard. Here are the steps to use VSCode shortcuts:
- Open Visual Studio Code: Start VSCode by opening it from your start menu or clicking on its desktop icon.
- Select the text or action you want to perform: To perform an action using a shortcut, you first need to select the text or action you want to perform. This can be done using your mouse or keyboard.
- Press the specified key combination: Once you have selected the text or action, press the specified key combination for the desired shortcut. For example, to copy text in VSCode, you can press Cmd + C on a Mac or Ctrl + C on a Windows computer.
- The action will be performed: The shortcut will trigger the desired action, such as copying, pasting, or navigating through code, saving you time and effort.
29 Essential VS Code Shortcuts For Mac & Windows
I. Basic Code Editing Shortcuts
One of the most important aspects of writing code is editing. Visual Studio Code provides several basic editing shortcuts that allow developers to save time and effort. Below are six essential shortcuts to start you off.
Action | Mac | Windows |
Copy | Cmd + C | Ctrl + Shift + Z |
Cut | Cmd + X | Ctrl + Shift + Z |
Paste | Cmd + V | Ctrl + Shift + Z |
Undo | Cmd + Z | Ctrl + Shift + Z |
Redo | Cmd + Shift + Z | Ctrl + Shift + Z |
Select All | Cmd + A | Ctrl + A |
Delete Line | Cmd + Shift + K | Ctrl + Shift + K |
Format Document | Cmd + Shift + i | Ctrl + Shift + i |
Toggle Comment | Cmd + / | Ctrl + / |
Toggle Block Comment | Cmd + Shift + / | Ctrl + Shift + / |
II. Code Navigation Shortcuts
Navigating through code can be a challenge, especially in large projects. Visual Studio Code provides several shortcuts to help developers navigate their code more efficiently. Here are three of the most helpful code navigation shortcuts in VSCode:
Action | Mac | Windows |
Go to Definition | Cmd + Click | Ctrl + Click |
Peek Definition | Cmd + Shift + F10 | Ctrl + Click |
Find All References | Cmd + Shift + F12 | Ctrl + Click |
III. Multi-Cursor Shortcuts
Working with multiple cursors can be a time-saving technique when writing code. Also, these shortcuts come in handy when you need to manipulate several lines of code simultaneously.
Here are three Multi-Cursor Shortcuts:
Action | Mac | Windows |
Add Cursor Above | Alt + Up Arrow | Shift+Alt+Down |
Add Cursor Below | Alt + Down Arrow | Shift+Alt+Up |
Select Next Occurrence | Cmd + D | Ctrl + D |
IV. File Management Shortcuts
Managing files and projects can be pretty tedious, especially when working on large code bases. Visual Studio Code has several file management shortcuts to help developers wade through files and folders in their projects.
Here are the three most useful file management shortcuts in Visual Studio Code:
Action | Mac | Windows |
Open Command Palette | Cmd + Shift + P | Ctrl + Shift + P |
Open a File | Cmd + P | Ctrl + P |
Save a File | Cmd + S | Ctrl + S |
V. Code Folding Shortcuts
Folding and unfolding code can be a time-saving technique when working with files with hundreds or thousands of lines of code.
These are three of the most useful code folding shortcuts in VS Code:
Action | Mac | Windows |
Fold Region | Cmd + Shift + [ | Ctrl + Shift + [ |
Unfold Region | Cmd + Shift + ] | Ctrl + Shift + ] |
Fold All Regions | Cmd + K, Cmd + 0 | Ctrl + K, Ctrl + 0 |
VI. VS Code Debugging Shortcuts
Debugging is an essential part of the software development process. However, it can be time-consuming, as bugs are very good at hiding. These shortcuts will help in your debugging sessions:
Action | Mac | Windows |
Start Debugging | F5 | F5 |
Step Over | F10 | F10 |
Step Into / Step Out Of | F11 | F11 |
Stop Debugging | F5 | F5 |
VII. Visual Studio Code Settings Shortcuts
Customizing the settings of Visual Studio Code can be a time-consuming process. To optimize your developer workflow, you should customize your IDE to your liking. You can use these three shortcuts to get going with configuring your VS Code;
Action | Mac | Windows |
Open Settings | Cmd + , | Ctrl + , |
Open Keybindings | Cmd + K, Cmd + S | Ctrl + K, Ctrl + S |
Open Extensions | Cmd + Shift + X | Ctrl + Shift + X |
Conclusion
Mac and Windows users can significantly increase their productivity and efficiency when writing, debugging, and running code using these essential Visual Studio Code shortcuts.
It may take some time to get used to these shortcuts, but once they become second nature, you’ll be amazed at how much time you save.
Remember, the more you use these shortcuts, the more intuitive they will become. Happy coding!
If you need to boost your productivity even more, here are my Top 10 Useful VS Code Extensions For Software Developers in 2024.