This content originally appeared on DEV Community and was authored by Thomas Sentre
In the world of software development, time is a precious commodity. With deadlines looming and projects piling up, anything that can save time and improve productivity is crucial. That's where Visual Studio Code (VS Code) comes in. As one of the most popular code editors available today, VS Code offers a plethora of powerful features and tools that can significantly streamline the coding process. One of the most valuable features of VS Code is its extensive set of keyboard shortcuts that allow developers to perform common tasks quickly and efficiently. In this article, we will be highlighting the 100 most important VS Code shortcuts that every developer should know to become more efficient and productive in their work.
1. Shortcuts for searching and navigating through source code
When working on a project with a large number of classes or multiple projects within the same solution, locating members of a class can be a daunting and time-consuming task. However, with the right tools, this process can be significantly streamlined. In Visual Studio, there are several keyboard shortcuts that allow for quick and easy navigation and search operations. Let's take a look at these shortcuts that can help us perform quick searches and navigation.
-
Ctrl + Q
: Displays Visual Studio Search -
Ctrl + T
: Displays the Go To All tool -
Ctrl + -
: Navigates backward between opened documents in the current session -
Ctrl + Shift + -
: Navigates forward between opened documents in the current session -
F12
: Navigates to a class definition -
Alt + F12
: Allows you to view and edit the code of a class in a pop-up window, from the code file you are writing. -
Ctrl + F12
: Navigates to the implementation of a member in a class -
Ctrl + Shift + F12
: Moves to the next error line when the error list window is open and more than one error is listed -
F8
: Navigates forward in the list of results of the current window -
Shift + F8
: Navigates backward in the list of results of the current window
2. Shortcuts for editing and refactoring
In this part, we will focus on the commands that enable direct changes to the source code. These commands are essential for carrying out common operations such as renaming members, commenting on lines of code, and moving lines up and down. By using the right keyboard shortcuts, these tasks can be accomplished with ease, improving productivity and efficiency. Without further ado, let's explore the list of shortcuts that will make writing code even more manageable.
-
Alt + Enter
: Displays quick actions -
Ctrl + K, Ctrl + I
: Obtains information about a member of a class -
Ctrl + K, Ctrl + C
: Comments multiple selected lines in the source code -
Ctrl + K, Ctrl + U
: Uncomments multiple selected lines in the source code -
Ctrl + Shift + L
: Deletes selected lines -
Ctrl + Shift + V
: Displays and allows pasting the contents from the buffer ring (it refers to the history of elements that have been previously copied) -
Ctrl + F
: Finds a specific text in the code -
Ctrl + A
: Selects all the lines in the current file -
Ctrl + S
: Saves the pending changes in the current file -
Ctrl + Shift + S
: Saves the pending changes in all the opened files -
Ctrl + Shift + .
: Zooms into the current file -
Ctrl + Shift + ,
: Zooms out from the current file -
Ctrl + Up
: Moves selected lines up in a code file -
Ctrl + Down
: Moves selected lines down in a code file -
Ctrl + K, Ctrl + D
: Applies the style rules to the entire document -
Ctrl + K, Ctrl + F
: Applies the style rules only in the selected lines in the document -
Ctrl + K, Ctrl + S
: Used to encapsulate the code between common clauses, such as cycles (while, for, and so on), control statements (if, switch, and so on), or code regions (#region). -
Ctrl + R
: Renames a member -
Ctrl + R, Ctrl + E
: Creates a property for a field of a class -
Ctrl + R, Ctrl + G
: Removes unused using statements in a class and sorts them alphabetically -
Ctrl + R, Ctrl + M
: Creates a method from the selected code -
Ctrl + X
: Cut line (empty selection) -
Ctrl + /
: Toggle line comment -
Ctrl + Home
: Go to beginning of file
3. Shortcuts for debugging and testing
When working with Visual Studio, debugging, and code execution are tasks that we perform constantly. As such, it is crucial to familiarize ourselves with the keyboard shortcuts that can facilitate these operations and enable us to carry them out quickly and efficiently. Knowing these shortcuts can save valuable time and boost productivity. So, let's take a look at the essential keyboard shortcuts that will help us execute code and debug with ease.
-
F5
: Starts the application in debug mode -
Ctrl + F5
: Starts the application without debug mode -
Shift + F5
: Stops the application when it's running -
Ctrl + Shift + F5
: Stops the application execution, rebuilds the project, and creates a new debugging session -
F9
: Places or removes a breakpoint -
F10
: Skips the execution of code when debugging -
F11
: Debugs source code line by line -
Shift + F11
: Steps out of the execution of the method -
Ctrl + R, Ctrl + A
: Starts unit test execution in debug mode -
Ctrl + R, A
: Starts unit test execution without debug mode
4. The most common shortcuts for use in the IDE
When working in VS Code, it's not uncommon to accidentally close essential windows such as the Solution Explorer or Properties window and struggle to locate the option to reopen them. Therefore, being familiar with the keyboard shortcuts for frequently used windows and panels can save significant time and effort. Let's explore the essential keyboard shortcuts that will help us move around the Visual Studio IDE with ease.
-
Ctrl + [ + S
: If we have a file open, this shortcut allows us to quickly select it in the Solution Explorer window. -
Ctrl + Alt + L
: Opens the Solution Explorer window -
Ctrl + Alt + O
: Opens the Output window. -
Ctrl + \, E
: Opens the Error List window -
Ctrl + \, Ctrl + M
: Opens the Team Explorer window. -
Ctrl + Alt + B
: Opens the Breakpoints window. -
F4
: Opens the Properties window. -
Alt + F6
: Allows you to scroll back between windows on the panels that are open. -
Shift + Alt + F6
: Allows you to scroll forward between windows on the panels that are open. -
Shift + Esc
: Allows you to close the current tool window -
Ctrl + Alt + Pg Up
: Allows scrolling up between open documents even when it is not the same session. -
Ctrl + Alt + Pg Dn
: Allows scrolling down between open documents even when it is not the same session. -
Ctrl + Tab
: Displays a special window with the open documents and selects the most recent one. -
Ctrl + Shift + Tab
: Displays a special window with the open documents and selects the least recent one. -
Shift + Alt + Enter
: Allows you to place the Visual Studio environment at full screen, allowing you to concentrate on the current document. Use the same shortcut to get out of full-screen mode -
Ctrl + K + K
: Creates a bookmark in the line where we are positioned. If there is already a bookmark on that line, it will be deleted. -
Ctrl + K + N
: Allows you to scroll forward through the different bookmarks that are part of a project. -
Ctrl + K + P
: Allows you to scroll backward through the different bookmarks that are part of a project. -
Ctrl + Shift + P, F1
: Show Command Palette -
Ctrl + P
: Quick Open, Go to File… -
Ctrl + Shift + N
: New window/instance -
Ctrl + Shift + W
: Close window/instance -
Ctrl + ,
: User Settings -
Ctrl +
: Show integrated terminal -
Ctrl + Shift +
: Create a new terminal
5. Shortcuts for file management
One of the key features of VS Code is its file management capabilities, which allow developers to efficiently create, open, edit, save, and organize files and folders. VS Code provides a range of keyboard shortcuts that enable developers to manage their files and folders quickly and easily. These shortcuts include creating new files and folders, opening and closing files, switching between open files, and accessing the Explorer panel to view the file and folder structure of the project. By using these shortcuts, you can save time, avoid errors, and stay organized while working on their projects. Here is a list of some of the most commonly used VS Code shortcuts for file management:
-
Ctrl + N
: Create a new file -
Ctrl + O
: Open a file -
Ctrl + S
: Save a file -
Ctrl + Shift + S
: Save all open files -
Ctrl + P
: Open the Quick Open dialog to quickly search and open a file -
Ctrl + Tab
: Switch between open files -
Ctrl + W
: Close the current file -
Ctrl + Shift + T
: Reopen the last closed file -
Ctrl + Shift + N
: Create a new folder -
Ctrl + Shift + E
: Show/hide the Explorer panel, which displays the file and folder structure of your project -
Ctrl+ K Enter
: Keep preview mode editor open
Summary
Visual Studio Code is a powerful code editor that provides a wide range of features and tools to help developers streamline their workflow. However, mastering keyboard shortcuts is crucial to unlocking the full potential of VS Code and becoming more efficient in development tasks. This article has provided a comprehensive list of 100 essential shortcuts that every developer should know. These shortcuts cover various areas such as file management, editing code, navigating the editor, and accessing VS Code features. By incorporating these shortcuts into your daily routine, you can save time and effort, reduce errors, and become more productive. With continued practice and familiarity with these shortcuts, you can elevate your coding skills to new heights and take full advantage of what VS Code has to offer.
THANK YOU FOR READING
I hope you found this little article helpful. Please share it with your friends and colleagues. Sharing is caring.
Connect with me on Twitter or LinkedIn to read more about JavaScript, React, Node.js, and more…!
Want to work together? Contact me on Upwork!
This content originally appeared on DEV Community and was authored by Thomas Sentre
![](https://www.radiofree.org/wp-content/plugins/print-app/icon.jpg)
Thomas Sentre | Sciencx (2023-03-19T12:21:34+00:00) 100 Vital VS Code Shortcuts Every Developer Should Know.. Retrieved from https://www.scien.cx/2023/03/19/100-vital-vs-code-shortcuts-every-developer-should-know/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.