DEV Community

20 VS Code shortcuts to speed up your flow ⚡️

Pauline on October 04, 2019

In this article I want to share some of my favorite and most used VS Code shortcuts that help me save time, make my life a little easier and, as a ...
Collapse
 
pavelloz profile image
Paweł Kowalski • Edited

I personally dont use "delete line" - just cut it and never paste it. ;)

On the other hand shortcuts i often use.

I might have some customs, so double check before using

toggle terminal (ctrl+`)
multicursor to the next line (shift+ctrl+down / or shift+ctrl+up)
duplicate line above/below (shift+alt+down)
move line up / down (alt+down / alt+up)

Collapse
 
pavelloz profile image
Paweł Kowalski • Edited

I would also recommend folding shortcuts to navigate bigger files, but since im not working on long files (js + includes in other languages) i dont need it - but if you are dealing with files 200+ lines long, i would highly recommend mastering folding + go to line + go to method

Collapse
 
molamk profile image
molamk

I second the ctrl+...

Collapse
 
goyalaman profile image
goyal-aman • Edited

Hey there windows users!!! To use these shortcuts in windows on VsCode, replace
⌘ - ctrl
⌥ - alt
⇧ - shift

Collapse
 
jameslivesey profile image
James Livesey

I personally use Ctrl + K ➡️ Enter as it keeps the newly-opened tab sticky and non-replacable by other files when you open them too!

And of course — how could I forget — Ctrl + Tab to switch tabs!

Collapse
 
httpspauline profile image
Pauline

I didn't know about ctlr + tab, thanks for sharing!

Collapse
 
jameslivesey profile image
James Livesey

No probs! It also works with many web browsers too. Just about anything with tabs!

I'm not sure it applies to VSCode (tho I bet it does) but you can also do Ctrl + 1 to Ctrl + 8 to select tabs 1 to 8, and Ctrl + 9 to select the last tab.

Collapse
 
albertomontalesi profile image
AlbertoM

Another one I use a lot is command shift P to open the command prompt.

One more, command K W to close all the windows

Collapse
 
httpspauline profile image
Pauline

I didn't know about these, thank you for sharing!

Collapse
 
josemunoz profile image
José Muñoz

No love for other platforms?

Collapse
 
httpspauline profile image
Pauline

Oh no absolutely, this is just the setup I personally use and can write about confidently. I highly encourage devs who do not use VS Code/work on Macbooks to discover the key bindings that have the same or similar functionality as the shortcuts I shared!

Collapse
 
josemunoz profile image
José Muñoz

I use VS Code too just not on a mac, thanks for the tips!

Collapse
 
albertomontalesi profile image
AlbertoM

I use both Ubuntu and macos, for most of them just swap command with control and you'll be fine

Collapse
 
thecaitcode profile image
Caitlyn Greffly

This is a great reference sheet! Bookmarked 🔖

Collapse
 
johnnyjab profile image
JohnnyJab

I am so grateful that you shared these, can't thank you enough for how much you just increased my productivity.

Collapse
 
rjmunhoz profile image
Rogério Munhoz (Roz)

Here are two that I use quite often:
Command (ctrl) + K M - Switch file language
Command (ctrl) + Shift + L - Select all occurrences of a term on the current file

Collapse
 
rjmunhoz profile image
Rogério Munhoz (Roz)

Also, Command + Option + F on Mac to auto format the current file
I'm not sure about the equivalent for other platforms as I reckon it's completely different

Collapse
 
dpliakos profile image
Dimitris Pliakos • Edited

Another one is to open second terminal Ctrl+shift+5
(let's say you have a gulp/grunt/webpack watcher that you want to see if it compiles)

Tip:
Terminal toggle is Ctr+ `

Collapse
 
gregfox profile image
Greg Fox

⇧⌘D - duplicate the selected code.

Collapse
 
balajik profile image
Balaji K

Great! I use few of those shortcuts. But always forget the shortcuts for duplicating the line and find the instances.

Thanks.

Collapse
 
smammar profile image
SMAmmar

nice

Collapse
 
chrisachard profile image
Chris Achard

Awesome :) I always forget that some of these even exist, so this is a great resource. Thanks!

Collapse
 
xdamiblock profile image
Damian Bocanegra

you can also use ⌘J to open up the terminal, I think it's easier that way

Collapse
 
aarone4 profile image
Aaron Reese

Ctrl +k->c to comment selected lines
Ctrl + k->u to uncomment
// Comments in PHP,sql, TS and is. <!----> comments in html.

Collapse
 
purandarrao profile image
Purandar

How can I split a file in editor to an already existing right side editor.

Collapse
 
anjankant profile image
Anjan Kant

Ctrl+Break ==> Build Cancel
Run Code Analysison Solution ==> Alt+F11
Break ALL ==> Ctrl+Alt+Break
Debug Start ==> F5

Collapse
 
jameslivesey profile image
James Livesey

Ah that's very useful, thanks! 😀

Collapse
 
kurd93 profile image
Kurd93

Useful, thanks with all appreciations.