Visual Studio Code top 10 useful keyboard shortcuts

Visual Studio Code top 10 useful keyboard shortcuts

Keyboard shortcuts can greatly improve your productivity and are sometimes more helpful than mouse clicks. We will see some of the top 10 keyboard shortcuts that are very powerful and highly useful while using Visual Studio Code. I am gonna talk about the shortcuts for Windows, for Mac, just replace ctrl with cmd key.

Open & Close Sidebar - Ctrl + b

You can easily open and close the sidebar with Ctrl + b . This really comes in handy when you are on a small screen and would like to save the display area. ctrl-b-1.gif

Quick open - Ctrl + p

When you want to open the recent files or open a specific file, you can use Ctrl + p to get a search bar and open the file from there. ctrl-p-new-1.gif

Keep Open - Ctrl + k Enter

When you open the file by a single click from the sidebar or through the quick open, the file will be replaced by the next file you open. So in case you want to keep open the current file, type in Ctrl + k Enter You can also notice the changes in the file name in the top bar once you "keep open" the file. ctrl-k-enter-1.gif

Integrated Terminal - Ctrl + `

To quickly open/close the integrated terminal use Ctrl + ` . Integrated Terminal is a really handy tool when you want to execute commands without opening a separate terminal or command prompt. ctrl-1.gif

Code Formatting - Alt + Shift + f

To format the entire document you can use Alt + Shift + f . This is really useful when you want to follow same formatting rules across files. altshiftenter-1.gif

Search within folder - Ctrl + Shift + f

While Ctrl + f allows you to search within the current file, Ctrl + Shift + f allows you to search within your open folder. ctrlshiftf-1.gif

Select Word - Ctrl + d

To select the entire word where your cursor is on, use Ctrl + d , If you hit Ctrl + d more than once, you’ll add another occurrence of the same keyword to your selection. This is very useful when you want to change the multiple occurrences of the same word. ctrld-1.gif

Select all occurrences of selection - Ctrl + Shift + L

In case you want to change a particular word or get the cursor across all the occurrences of word or selection use Ctrl + Shift + L. Alternatively, you can also use Ctrl+F2 to get the same behavior. ctrlshift-l-1.gif

Close the currently open file - Ctrl + w

Close the open file with this shortcut instead of hovering over the tab finding the 'x' and clicking it. To close all the open files, use Ctrl + k w. ctrlw-2.gif

Command Palette - Ctrl + Shift + p

One of the most important feature of VS Code is Command Palette. It lets you execute tasks in VS code. Use Ctrl + Shift + p to bring up the command palette. You can type in any task you want to achieve and VS Code will search for the task for you. If a keyboard shortcut exists, it will show that too. ctrlshift-p-1.gif

That's it! The top 10 keyboard shortcuts for VS code. To view all the available shortcuts use Ctrl + k Ctrl + s or Ctrl + k s To read more about all the key bindings, visit the official keybindings document .

Did you find this article valuable?

Support Kumar Ashwin Hubert by becoming a sponsor. Any amount is appreciated!