Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for 23 lesser known VS Code Shortcuts as GIF
Andreas
Andreas

Posted on • Edited on

     

23 lesser known VS Code Shortcuts as GIF

Despite many shortcuts I'm using frequently in VS Code, the following ones can come in very handy but I'm often forgetting they even exist. I made some GIFs for visualization to better remember them. Maybe there are some shortcuts you didn't remember either but are useful for you.

Every command in VS Code can also be executed via command prompt withCTRL+SHIFT+P and a search query. But knowing the direct shortcut might be faster.

I use VS Code on Windows in the GIFs, but I also provide a table showing the shortcuts for both Windows and Mac for each command.

1.CTRL+, = Open user settings

WindowsMac
CTRL+,+,

Open user settings in VS Code

Once in a while I need to adjust my user preferences, this is how you open them directly.

2.CTRL+K  CTRL+S = Show shortcuts

WindowsMac
CTRL+K  CTRL+S+K  +S

Show shortcuts in VS Code

This is the complete list of shortcuts in VS Code. There is also aWindows Cheat-Sheet [PDF] andMacOS Cheat-Sheet [PDF] available to download.

3.CTRL+R = Switch workspace

WindowsMac
CTRL+R+R

Switch workspace in VS Code

This opens a list of your recent workspaces and is a super fast way to switch to another folder or project. Note that this will kill you current terminal session, if you had a terminal open in your VS Code workspace.

4.ALT+Z = Toggle word wrap

WindowsMac
ALT+Z+Z

Toggle word wrap in VS Code

A handy little helper when you quickly want to see complete lines without scrolling horizontally.

5.CTRL+G = Go to line

WindowsMac
CTRL+G^+G

Go to line in VS Code

This is the shortcut for typingCTRL+P  :.

6.CTRL+P = Go to file

WindowsMac
CTRL+P+P

Go to file in VS Code

The fastest way to switch files (especially when they are not already open) without using the mouse.

7.F8 = Go to next error or warning

WindowsMac
F8F8

Go to next error or warning in VS Code

This is debugging with a single key. You can also go to previous errors or warnings usingSHIFT+F8.

8.CTRL+TAB = Switch tabs

WindowsMac
CTRL+TAB^+TAB

Switch tabs in VS Code

The fastest way to switch already open files without using the mouse.

9.SHIFT+ALT+I = Insert cursor at end of each line selected

WindowsMac
SHIFT+ALT+I++I

Insert cursor at end of each line selected in VS Code

This is useful for a quick creation of multiple cursors in the selected area.

10.CTRL+L = Select current line

WindowsMac
CTRL+L+L

Select current line in VS Code

Use this i.e. to search for identical lines in combination with the next shortcut.

11.CTRL+SHIFT+L = Select all occurrences of current selection

WindowsMac
CTRL+SHIFT+L++L

Select all occurrences of current selection in VS Code

This shortcut really saves time because you don't have toCTRL+D through a whole file.

12.CTRL+F2 = Select all occurrences of current word

WindowsMac
CTRL+F2+F2

Select all occurrences of current word in VS Code

With this you don't even have to select something anymore. Just place the cursor on the word you want to select all occurrences of.

13.CTRL+SHIFT+SPACE = Trigger parameter hints

WindowsMac
CTRL+SHIFT+SPACE++SPACE

Trigger parameter hints in VS Code

In case you don't remember parameter order and don't want to interrupt your flow by looking into the docs.

14.SHIFT+ALT+F = Format document

WindowsMac
SHIFT+ALT+F++F

Format document in VS Code

Because nobody wants to format a whole file manually.

15.CTRL+K  CTRL+F = Format selection

WindowsMac
CTRL+K  CTRL+F+K  +F

Format selection in VS Code

In case you want to format only some parts of a file.

16.F12 = Go to Definition

WindowsMac
F12F12

Go to Definition in VS Code

The quick way to jump to the definition of a variable or function.

17.ALT+F12 = Peek Definition

WindowsMac
ALT+F12+F12

Peek Definition in VS Code

This just shows the corresponding definition of a variable or function without moving the cursor.

18.F2 = Rename Symbol

WindowsMac
F2F2

Rename Symbol in VS Code

An indispensible shortcut for refactoring code.

19.CTRL+K  CTRL+X = Trim trailing whitespace

WindowsMac
CTRL+K  CTRL+X+K  +X

Trim trailing whitespace in VS Code

This is especially useful for multi-line selections.

20.CTRL+K  R = Reveal active file in Explorer

WindowsMac
CTRL+K  R+K  R

Reveal active file in Explorer in VS Code

In case you want to perform some actions out of your systems file manager instead of VS Code.

21.CTRL+SHIFT+H = Replace in files

WindowsMac
CTRL+SHIFT+H++H

Replace in files in VS Code

If only one file at a time isn't enough for you.

22.CTRL+K  V = Open Markdown preview to the side

WindowsMac
CTRL+K  V+K  V

Open Markdown preview to the side in VS Code

This way you don't have to switch to the mouse to open a preview.

23.CTRL+K  Z = Enter Zen Mode

WindowsMac
CTRL+K  Z+K  Z

Enter and exit Zen Mode in VS Code

Instantly coding distraction free. To exit Zen mode, hitESCESC.

 

So that's it for now. I maintain a repository on GitHub, where I collect commands I tend to forget - check it out if you want:

GitHub logo devmount / CheatSheets

A curated list of everything I look up more than twice

Happy Coding!


Edited: 7th January 2020 (add MacOS shortcuts)
Published: 7th January 2020
Cover Image:https://codepen.io/devmount/full/ExaQjdm

Top comments(74)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

Cool article! 👍
If will be nice to add a MacOS shortcut as well.

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Thank you! As I wrote at the top of the article:

I use VS Code on Windows here, if you are on a Mac, most of the Shortcuts should work using forCTRL, forALT and forSHIFT.

CollapseExpand
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

That's not always correct. You can check out my post about shortcuts in Visual Studio Code
dev.to/peacefullatom/productivity-...

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Nice article layout and many thanks for the feedback! I will see how I can include MacOS shortcuts as well!

Thread Thread
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

You're welcome!
Tip: you can ask the community to help you 😊

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Updated the article accordingly 😇

Thread Thread
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

Whoa! Well done! 👍👊

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Thank you for the inspiration! 👍🏻

Thread Thread
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

You're welcome! 👍

Thread Thread
 
andrewdc profile image
Andrew Colclough
Illustrator and Designer. That's what I do.
  • Location
    Austin, Texas
  • Work
    Sr. UX Engineer at Remote
  • Joined

Can I just say, it's nice to see people in comments helping each other out? I guess you just see criticism so often, it's nice to see folks working together to make something great. Makes for an awesome community. Thanks guys!

Thread Thread
 
peacefullatom profile image
Yuriy Markov
programmer, photographer, cook and proud father of four boys :)
  • Email
  • Location
    Russia
  • Education
    Self-taught
  • Work
    Senior front-end developer at EPAM
  • Joined

Welcome to the club! Glad you've joined! 👍

CollapseExpand
 
grahamdyson profile image
Graham Dyson
  • Location
    UK
  • Work
    Developer / Architect at DevSnicket
  • Joined

I stopped plugging in a mouse, touchpad etc several months ago on my dev machine (I do have a mousekeys AutoHotkey script). It definitely encouraged me to find those keyboard shortcuts. Not so good for web browsing tho. VSCode is probably going to wear out my F1 key! 😄⌨

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Wow, not using a mouse at all is impressive! 😲👏🏻 Maybe I'll try that too sometimes!

CollapseExpand
 
grahamdyson profile image
Graham Dyson
  • Location
    UK
  • Work
    Developer / Architect at DevSnicket
  • Joined

I do also have a portable with touch screen and pen to do any graphics and cad stuff on. But just a keyboard front and centre on the dev desktop 😇
my mousekeys script is on the following gist if you ever want to try it out:gist.github.com/grahamdyson/3029ef...

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Cool! Thank you for sharing!

CollapseExpand
 
vaibhavkhulbe profile image
Vaibhav Khulbe
✦ Independent web developer/designer/blogger✦ Framer Expert & Partner | Advocate at 10x Designers✦ Hire me on Contra👇

Wow. I always wondered how to select a line using a keyboard. It's so simple and easy shortcut for which I had to point to the line and then select it using the cursor. This will save a lot of time. Also, that open in explorer shortcut is also a great one. Thanks for this!

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

I'm really glad it's useful for you! It was the same here before I knew that line selecting shortcut 😅

CollapseExpand
 
albertochiesa profile image
Alberto Chiesa
  • Joined

I prefer the use of HOME and END to go to start/end of line, coupled with SHIFT when I need to select. So HOME, followed by SHIFT-END is just the same as select line, and a lot easier to memorize, for me.

CollapseExpand
 
shmink profile image
Tom Nicklin
  • Work
    Full Stack Engineer at Boomin
  • Joined

Select some characters, a var name or whatever.ctrl+D is my favourite, although not the quickest way, to select the next occurrence of what you currently have selected. Habits I guess.

CollapseExpand
 
shaijut profile image
Shaiju T
I am a Full stack .NET Developer, I like to work with C#, .Net Core, SQL, Mongo DB, Azure, JavaScript , Angular...Always eager to learn new technologies. I am here to share, ask & eventually learn.
  • Location
    India
  • Education
    MSC SE
  • Work
    Software Engineer
  • Joined

Thanks , this will be great help. Curious to know which shortcuts do you use frequently in your work ?

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined
• Edited on• Edited

You're welcome. Sure, I highlighted them for you:

Frequently used shortcuts by devmount in VS Code

Those are the shortcuts I use every day.

CollapseExpand
 
shaijut profile image
Shaiju T
I am a Full stack .NET Developer, I like to work with C#, .Net Core, SQL, Mongo DB, Azure, JavaScript , Angular...Always eager to learn new technologies. I am here to share, ask & eventually learn.
  • Location
    India
  • Education
    MSC SE
  • Work
    Software Engineer
  • Joined
• Edited on• Edited

What aboutCtrl +` - Shows integrated terminal ? By the way thanks for the image. Appreciate 😄.

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Also a good one, but I don't need it since I have the integrated terminal always open in each of my workspaces 😇

Thread Thread
 
kvnloughead profile image
Kevin Loughead
A beginner.
  • Location
    Pennsylvania
  • Work
    Looking for one
  • Joined

Ctrl +` alsoselects the terminal, which is great for rapid fire git commits! Etc.

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Awesome, didn't know this 👏🏻

CollapseExpand
 
10xgeek profile image
Henry
I'm a passionate IT guy.
  • Location
    Worldwide
  • Work
    Software Developer at ByteStax Solutions
  • Joined

What software or tool did you use to display those keyboard shortcuts on your screen as you typed them?

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

I'm usingScreenToGif. It's a really useful open source tool to quickly create screencasts. The shortcuts can to be inserted in editing mode.

CollapseExpand
 
10xgeek profile image
Henry
I'm a passionate IT guy.
  • Location
    Worldwide
  • Work
    Software Developer at ByteStax Solutions
  • Joined

Thank you so much!!

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

You're welcome 😊

CollapseExpand
 
klukiyan profile image
Kiril Lukiyan
Next time
  • Location
    Prague
  • Work
    Developer at Tpvision
  • Joined

This is a collection of good and useful shortcuts for everybody. Though they are not lesser known. Using 95% of them all the time since switching to vscode

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Thank you for your feedback! So you're a real VS Code pro user! Which command didn't you already know (the 5%)?

CollapseExpand
 
klukiyan profile image
Kiril Lukiyan
Next time
  • Location
    Prague
  • Work
    Developer at Tpvision
  • Joined
• Edited on• Edited

3)CTRL+R (such a good one, I somehow didn't know or think about it before)
19)CTRL+K CTRL+X

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Well so I'm glad, that there were at least 2 shortcuts that were helpful for you too 😅

CollapseExpand
 
russ profile image
Russ
Software Engineer
  • Location
    Charlotte, NC
  • Education
    Thinkful
  • Work
    Software Engineer
  • Joined

Great read, thank you for sharing! Now I just need to practice some of them to help remember them.

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

You're welcome! So do I 😅

CollapseExpand
 
russ profile image
Russ
Software Engineer
  • Location
    Charlotte, NC
  • Education
    Thinkful
  • Work
    Software Engineer
  • Joined

After I read the article I immediately needed to use one of them and forgot the shortcut but remembered it's possible 😬

Thread Thread
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

😂 Well, do this a couple more times and you won't forget anymore 😅

CollapseExpand
 
herobank110 profile image
David Kanekanian
Artisan programmer
  • Joined

Actually, the fastest way to switch tabs without using the mouse is usingAlt + {n} where n is the tab index.

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

Agreed! Thank you for this addition!

CollapseExpand
 
ndkhoa1011 profile image
Nguyen Duy Khoa
  • Location
    Vietnam
  • Work
    Developer at Vietnam
  • Joined

Thanks a lot

CollapseExpand
 
devmount profile image
Andreas
freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

You're welcome ☺️

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

freelancing software engineer.javascript. php. python. css.husband. dad². guitarero. climber. retrogamer.
  • Location
    Berlin, Germany
  • Education
    M.Sc. Computer Engineering
  • Pronouns
    he/him/his
  • Work
    Freelancing Software Engineer
  • Joined

More fromAndreas

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp