Shortcut your way to faster coding in Visual Studio Code

If you spend most of your workday writing code in various languages and frameworks in Visual Studio Code, shaving off some time from using the touchpad to navigate and modify the code can greatly improve your speed of task delivery. You may very well be spending an extra hour a day just because you’ve never taken the time to learn the proper keyboard shortcuts.


You will probably not be able to master them all in a day. I'd choose one a week and make a concerted effort to incorporate it into your daily work routine.

So here are some that have proven very useful for me, and I use them on a daily basis (note that I use Linux/Windows but Mac OS alternatives are usually very close).

You will find that most of them have alternative shortcuts too; these are just the ones that I use.

Delete the current line: Ctrl + Shift+ K

Imagine you were to delete your lines by finding your line with the mouse cursor, selecting your line with a double click and then pressing delete — now compare this to using Ctrl + Shift + K — you’re most likely already at the line with your keyboard cursor, so there’s virtually no overhead to deleting it. I use it all the time.

Select current line: Ctrl + L

Selecting the line is also a pretty involved process, as you need to find the line you’re already at with your mouse cursor and then double-click it, which can usually throw you off your keyboard-based flow greatly. This one is a serious timesaver.

Select current word: Ctrl + D

Lately I've also been using Mac OS a lot and have found it incredibly challenging to select the current word with my touchpad. Ctrl + D (or, well, the Mac alternative to it) comes to the rescue.

Move line: Alt + Up/Down

Moving lines around is something I do practically all day. Imagine you were to find the line with your mouse cursor, selecting it with a double click, copying it with a right click and selecting Copy, deleting it with Delete, finding the line you want to insert it at with your mouse cursor, creating a new line, then pasting it with a right click and selecting Paste. Try using the simple alternative — Alt + Up/Down. It will save you a ton of time and I guarantee you that it will provide you with a smoother and more enjoyable development experience.

Indent/outdent line: Ctrl + ([/])

While you could use the standard Tab and Shift + Tab, this would require you to be at the start of the line to outdent, which is not ideal. Ctrl + [ or Ctrl + ] to the rescue!

Select all occurrences of a variable: Ctrl + D && Alt + Enter

This is particularly useful for variable renaming. You select the current word with Ctrl +D or just move your cursor to it and press Alt + Enter and voilà! You will be able to rename it seamlessly, saving you a ton of time.

Automatic import: Ctrl + I

This will give you a list of suggestions for importing a class, interface, etc. that you are trying to use and then auto import it upon selection. I cannot begin to explain how useful this is. It does not always work perfectly, especially if it’s the first time importing something into a project, but in most other cases it will work perfectly. It will save you a ton of time compared to either finding the right import statement or copying it from somewhere else.

Search files by name: Ctrl + P

Using the file explorer on the left is fine, but when you’re really familiar with the project, you usually know exactly what you’re looking for — filename wise. As a result, using Ctrl + P and typing the first couple of characters to open a file will be much faster.

Finding references to a function: Alt + Shift + F12

Finding references to a function is something I do all the time, especially during code reviews and such. I, however, do find this shortcut a bit hard to remember and my keyboard has the sleep button on F12 by default, so there’s no room for mistakes.

Move up and down in the file: Ctrl + Up/Down

Instead of resorting to the cursor while in keyboard mode to scroll up or down the currently open file, just use Ctrl + Up or Ctrl + Down. You could use PgUp or PgDown too, but these are usually farther away from the keys you use all the time.

Open find in workspace: Ctrl + Shift + F

I find myself searching for things workspace-wide all the time and it’s really tedious to break out of a keyboard-based workflow just to open the find in workspace panel.

Open the terminal pane: Ctrl + `

I’m constantly using the built-in terminal in VSCode. This will bring it forward regardless of where you are.

Open a new terminal in the terminal pane: Ctrl + Shift + 5

You will most often need more than one instance of the built-in terminal. Instead of always searching for the icon to split the pane, use this great keyboard shortcut.

Open a folder in a new instance: Ctrl + Shift + N && Ctrl + K && Ctrl + O

I often surf between different projects in VSCode and find myself wanting to open a new one all the time. For this, you open a new VSCode window with Ctrl + Shift + N, then open the folder selector with Ctrl + K && Ctrl + O. Voila!

And, of course, there are some that are useful outside of VSCode:

Close tab: Ctrl + W

This is a standard shortcut to close tabs, and if you do not use it, you really should.

Change text size: Ctrl + (+/-)

Especially useful when showcasing your work in a Zoom meeting, the default text is usually too small to see on a compressed video stream.

Find in file: Ctrl + F

Probably not much is needed to say about that, because you should already be using it everywhere.

Is there another one you use frequently that you couldn't find on this list? Leave a suggestion in the comments!