DEV Community

Pauline
Pauline

Posted on • Edited on

20 VS Code shortcuts to speed up your flow ⚡️

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 heavy keyboard user, also allow me to stay in my developer flow.

You may be familiar with some of them already but hopefully you will discover a new shortcut that you can introduce into your workflow starting right now. 🤞🏻

I jotted down the key combinations for Mac users. If you’re a Windows or Linux user, you can find the key bindings for your OS here.

Alright then, so without needing to select the entire line first...

  • ⌘X - cut a line
  • ⌘C- copy a line
  • ⇧⌘K - delete a line
  • ⌘L - select the line

And while your cursor is on a specific line..

  • ⌘Enter - insert a new line below it
  • ⇧⌘Enter - insert a new line above it
  • ⌥↑ and ⌥↓ - move the line up/down
  • ⇧⌥↑ and ⇧⌥↓ - duplicate line on the line above/below it
  • ⌘] and ⌘[ - indent and outdent the line
  • ⌘/ - (un)comment out the line

Or within a specific file..

  • ⌘D - find other instances of selected code
  • ⌥Z - toggle word wrap

Lastly, for some editor/window management..

  • ⌘P - find and go to file (quick open)
  • ⌘N - new editor
  • ⌘W - close editor
  • ⌘B - toggle visibility of the side panel
  • ` - toggle visibility of the integrated terminal
  • ⌘2 - split screen into two editor groups
  • ⇧⌘T - reopen recently closed editor
  • ⌥⌘← and ⌥⌘→ - view editor tab on the left/right

Happy coding!


If you enjoyed reading this post or if it was helpful to you, you can support me by buying me a coffee — I'd really appreciate it! 🙏

Oldest comments (31)

Collapse
 
smammar profile image
SMAmmar

nice

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
 
chrisachard profile image
Chris Achard

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

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
 
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
 
molamk profile image
molamk

I second the ctrl+...

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
 
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
 
purandarrao profile image
Purandar

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

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
 
thecaitcode profile image
Caitlyn Greffly

This is a great reference sheet! Bookmarked 🔖

Collapse
 
goyalaman profile image
goyal-aman • Edited

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

Some comments may only be visible to logged-in visitors. Sign in to view all comments.