DEV Community

Cover image for 10 useful VS Code shortcuts you should know  ()

10 useful VS Code shortcuts you should know ()

Mariana Simon on April 14, 2021

This is a curated list of the shortcuts you should learn as soon as possible. I really wish I knew them when I started coding. It would have saved ...
Collapse
 
equiman profile image
Camilo Martinez • • Edited

Excellent recommendations! I would like to add this information:

  • ctrl+i also does the same as ctrl+space it was introduced recently.
  • When using ctrl+d and select more elements than expected, you can undo selections with ctrl+u
Collapse
 
who8mypnuts profile image
Stan •

Thanks! I always wondered about undoing selections when I got too much.

Collapse
 
anduser96 profile image
Andrei Gatej •

Thanks for sharing! Didn't know about Wrap with Abbreviation, that's cool.

Collapse
 
josef37 profile image
Josef Wittmann • • Edited

Fold that stuff! 😄

Have a look at the folding/unfolding shortcuts (I can't post them here, because of my German keyboard). Especailly those which allow you to fold/unfold at your current position. That makes navigating new projects so much easier.

Collapse
 
kiranjd profile image
kiranjd • • Edited

Fold everything: cmd/ctrl + k then 0

Collapse
 
agredalex profile image
Alex Ágreda •

Ctrl + Shift + [ to fold
Ctrl + Shift + ] to unfold

Collapse
 
mostafiz93 profile image
Mostafiz Rahman •

This is also useful:

cmd + j to toggle Terminal/Output/Debug Console view

Collapse
 
simonpaix profile image
Mariana Simon •

Nice addition. Thanks, Mostafiz!

Collapse
 
laxedo17 profile image
laxcivo •

thanks. While not a shortcut, for errors, Error Lens is amazing! One of the best VS Code extensions.

Collapse
 
simonpaix profile image
Mariana Simon •

True! I love it too

Collapse
 
lokeshsenthilkumar profile image
Lokesh Senthilkumar •

shift+alt+down to copy the current line

Collapse
 
simonpaix profile image
Mariana Simon •

Good one 👍

Collapse
 
piotrnajda3000 profile image
piotrnajda3000 •

Ctrl + K then V for Markdown preview / edit in split view.

Collapse
 
qq449245884 profile image
qq449245884 •

Dear Mariana Simon Paixao,may I translate your article into Chinese?I would like to share it with more developers in China. I will give the original author and original source.

Collapse
 
simonpaix profile image
Mariana Simon •

Hi there! Sure, I don't see any problem if you include the original author and source. Can you send me a link when you do so? I have Chinese friends and would like to share with them :)

Collapse
 
qq449245884 profile image
qq449245884 •

no problem!

Collapse
 
vinceamstoutz profile image
Vincent Amstoutz •

Very interesting, I did not know them all, thanks ! 👍🙂

Also, I often use Ctrl + G to go to a particluar number of line.

Collapse
 
simonpaix profile image
Mariana Simon •

Nice. I didn't know about this one 👍

Collapse
 
tilkinsc profile image
Cody Tilkins •

I swapped ctrl + d and ctrl + shift + d to delete line and duplicate line. I don't make that much use of selecting one by one. I use ctrl + shift + L which selects all alike more.

Collapse
 
simonpaix profile image
Mariana Simon •

Nice tip! Thanks, Cody

Collapse
 
shubhamb profile image
Shubham_Baghel •

Thanks for Sharing Very useful!

Collapse
 
youpiwaza profile image
max •

Learned a few more. Thanks a lot ;)

Format all file instead of Palette > Reindent. that's cool

Collapse
 
mcwertgaming profile image
Damon Leven •

This is a bit basic, but with STRG+shift+ARROW you can extend your cursor to write on multiple lines at the same time.

Collapse
 
vjnvisakh profile image
Visakh Vijayan •

Ctrl shift I was a new one for me. Thanks

Collapse
 
nostop8 profile image
Volodymyr Dovbenko •

Before moving lines using alt+up or down, I usually use shift+up or down in order to select multiple lines. Saves some time too.

Collapse
 
andrewbaisden profile image
Andrew Baisden •

Great stuff!

Collapse
 
gilfewster profile image
Gil Fewster •

While not a shortcut, using regular expressions with the search box is staggering powerful and well worth exploring.

Collapse
 
sebasprogrammer2020 profile image
SebasProgrammer2020 •

muchas gracias. el bonus estuvo super! thanks a lot

Collapse
 
testerslol123 profile image
Danny S •

Thanks for sharing, I just saw this post, and I will try it in my visual studio code.

The things that I always use is ctrl + P and ctrl + /

Collapse
 
cespujunk66 profile image
cespujunk66 •

thanks, very interesting!

Collapse
 
maneesh8040 profile image
Maneesh Kumar 🇮🇳 •

thanks

Collapse
 
gpakyoo profile image
Godluck Akyoo •

Wrap with Abbreviation, just increased my efficiency by many folds, Thank you.

I would like to add Alt + Shift + Up/Down arrow duplicate line or a block of code selected.

Collapse
 
simonpaix profile image
Mariana Simon •

Thanks! Nice addition 👍

Collapse
 
loganliffick profile image
Logan Liffick •

Wrap with abbreviation is a game changer, great list!

Collapse
 
simonpaix profile image
Mariana Simon •

Thanks, Logan!

Collapse
 
piotrnajda3000 profile image
piotrnajda3000 •

Ctrl + Shift + K for removing a line!

Collapse
 
designeranna1 profile image
Designer Anna •

Shortcut to move line is my fav.
Thanks to share all these shortcuts. 😇

Collapse
 
amanchourasia profile image
Aman Chourasia •

Great! 👏

Collapse
 
simonpaix profile image
Mariana Simon •

Thanks, Aman!

Collapse
 
julianperezpesce profile image
Julián Pérez Pesce •

ctrl + k + c to comment multiple lines selected
ctrl + k + u to uncomment the multiple lines selected

Collapse
 
jonatannietoa profile image
Jonatan Nieto •

Wrap with Abbreviation is a cheat that is very useful! Great post!

Collapse
 
simonpaix profile image
Mariana Simon •

Thanks, Jonatan! Yeah, I use it a lot!

Collapse
 
samuel_marien profile image
Samuel Marien •

Thanks, so useful !

Collapse
 
simonpaix profile image
Mariana Simon •

Thanks, Samuel!

Collapse
 
iamthebuilder profile image
The Builder •

Thanks for sharing

Collapse
 
faisalahammad profile image
Faisal Ahammad •

Much appreciated

Collapse
 
chadyka profile image
Jakab Ádám •

Great article! 10. Shows the same gif as 4. though. Maybe you could correct that.

Collapse
 
simonpaix profile image
Mariana Simon •

Thank, you! Jakab! I corrected that, thanks :)