DEV Community

5 Visual Studio Code Hacks That You Will Thank Me For (And They're Not Common Points Like "Install Prettier Extension")

Mohmed Ishak on July 11, 2021

Hello coders! You've always heard the same VS Code hacks over and over again like "install Prettier extension to format your code", "press alt + sh...
Collapse
 
mitsuriou profile image
Mitsuriou • Edited

Great tips!

For the point [3], I would mention the option below, too:
"editor.mouseWheelZoom": true

This allows you to zoom only the editor with CTRL+mouse scroll, instead of the full GUI :)

Collapse
 
jyotishman profile image
Jyotishman Saikia

this point is really helpful. I would love to tweet this

Collapse
 
blackr1234 profile image
blackr1234 • Edited

I think, without this option, ctrl+scroll will just scroll up/down but not zooming in/out. Ctrl+"+" will still increase the font size of the whole GUI.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you, Mitsuriou!

Collapse
 
albas99 profile image
Faisal Albasu

This is great, I've always wanted to change the color of my comments to something more visible and it's always annoying when I want to open a file and it closes the current file I'm in. Thank you for these tips. Definitely worth sharing with the world.

Collapse
 
genius_rick profile image
IT-iddiot

You can install an extension called Better Comments to highlight your comments marketplace.visualstudio.com/items...

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Nice.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome!

Collapse
 
zulvkr profile image
zulvkr

What annoy me the most in code is I can't hide terminal fast and focus switching between terminal and editor quickly. Or may be I missed it..

I'm trying to make a new keyboard shortcut, but haven't figured the correct one.

Any suggestions?

Collapse
 
ishakmohmed profile image
Mohmed Ishak • Edited

If you use the integrated terminal in VS Code, press ctrl + '`' (backtick key) to open and minimize (not delete) the terminal real quick. If you use an external terminal, press alt + tab to switch between VS Code and other windows including your external terminal. These shortcuts might be slightly different for Mac OS but definitely would be very similar to what I've mentioned in here.

Collapse
 
zulvkr profile image
zulvkr • Edited

The minimize terminal works! May be i just need to muscle memory a bit. Now i only need the cycle thing

Thread Thread
 
ishakmohmed profile image
Mohmed Ishak

Cool. 😊

Thread Thread
 
zulvkr profile image
zulvkr

I get the trick now. It turns out Ctrl + ` will focus on terminal instead of closing when it doesn't have focus on terminal itself. So I have to click it twice to close it.

Such a smart boy.. not. Annoying really.

Thread Thread
 
ishakmohmed profile image
Mohmed Ishak

🤣👍

Collapse
 
kirancraft profile image
KiranCreativeCraft

Use ctrl+j to quickly toggle terminal

Collapse
 
chriswood profile image
Chris Wood

ERRMYGERD that stupid tab replacing the last one thing makes me want to throw my computer into the toilet. Thank you these are all useful! I admit I am like the person who said the one they got the most out of was the alt shift down one though heeehe.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Glad you liked them, Chris!

Collapse
 
stefannastic profile image
Stefan Nastic • Edited

Lately I've been also optimizing dev experience with development containers in VS Code. You can check out a how to here and some of main lessons learned here. My aim was mainly to support an open source project I lead, but I think it can be applied to any sort of projects.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you, I'll check them out.

Collapse
 
uzair004 profile image
Muhammad Uzair

Part 1 is useful, when opening new file and older closes is quite annoying. But what i don't understand is how uncheck new tab option will work. Isn't it opposite. Like open file in new tab should be checked so vscode open every file in new tab ?

Collapse
 
ishakmohmed profile image
Mohmed Ishak • Edited

I think we're referring to different settings. Anyway, open your settings.json file and add this if it doesn't work:

"workbench.editor.enablePreview": false
Enter fullscreen mode Exit fullscreen mode
Collapse
 
reikrom profile image
Rei Krom
  1. If the tab name is in italics it'll get replaced when opening a new tab. If you double click the tab it'll change to non-italics and will persist.
Collapse
 
ishakmohmed profile image
Mohmed Ishak

Cool.

Collapse
 
rkn_dev profile image
rkn

Nice tips, funnily enough the one I'll use the most is
"press alt + shift + down key to duplicate code"

... also that snippet site! I've been painfully doing mine by hand lol

Xoxo

Collapse
 
ishakmohmed profile image
Mohmed Ishak

😊

Collapse
 
yogesnsamy profile image
Yogeswari Narayasamy

All good tips including number five. I wanted to give you a like just after reading number 1!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you. Fun fact: we're from the same country.

Collapse
 
yogesnsamy profile image
Yogeswari Narayasamy

Oh how cool is this 😀 Hai!

Thread Thread
 
ishakmohmed profile image
Mohmed Ishak

Thanks for the support.

Collapse
 
cemuka profile image
Info Comment hidden by post author - thread only accessible via permalink
Cem Ugur Karacam • Edited

not common? change font size and change theme? seriously?

Collapse
 
ishakmohmed profile image
Mohmed Ishak

No, I didn't explain about changing font size. If you read my article carefully (and if you do try that shortcut out on your keyboard), you'll realize that pressing ctrl + '-' zooms out the entire VS Code content including the menu bar and side bar. In contrast, if you change the font size, the size of menu bar and side bar still stay the same. As for the theme part, I did mention it's an obvious point (because it goes against the title).

Collapse
 
cemuka profile image
Cem Ugur Karacam • Edited

"And They're Not Common Points Like "Install Prettier Extension"

So zooming and saying install a theme does not count as a common point right?

Thanks for clickbait content.

Thread Thread
 
ishakmohmed profile image
Mohmed Ishak

You're welcome.

Collapse
 
justummar profile image
Justummar

Point 3, i thought that is why zen mode exists.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

I just got to know this feature from you.

Collapse
 
badare_okiemute_kelvin profile image
OKIEMUTE BADARE

Nice tips

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Collapse
 
ipapoutsidis profile image
Ilias Papoutsidis

@Mohmed Ishak indeed very useful tips, a special the first one!!!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you very much.

Collapse
 
fahimahmed525 profile image
Md.Sanaullah(fahim)

Great post, VS code is really awesome 😎
Please keep continue.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Collapse
 
thomasjyoung profile image
Thomas Young

The 1st point is super useful! Been annoying me for ages, when the current open file, gets replaced with another. Thanks :)

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Yes, it had been an unsolved mystery for years.

Collapse
 
rop89 profile image
Rita(they/them)

Great tips! Was completely unaware of the comments one 👍

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you so much.

Collapse
 
johnjacobkenny profile image
Kenny John Jacob

Great points, I am sure beginners will appreciate them 🙂

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Collapse
 
skygil profile image
Skye Gilbreth

Great article! The first point is one of the most annoying things to me with VS. Thanks!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Yeah, it annoys the heck out of every dev.

Collapse
 
dim0147 profile image
Bon

To Select Language Mode for current open file, press "Ctrl + k" then release and press "m"

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Nice.

Collapse
 
tuxstyle profile image
Chris C

Which theme are you using? I like those popping colors.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Monokai theme (available by default) + Bracket Pair Colorizer 2 extension for striking brackets.

Collapse
 
endershadow8 profile image
EnderShadow8

In fact, just go ahead and customise your entire colour scheme. #2 is a bit underwhelming tbh.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

My bad.

Collapse
 
rangercoder99 profile image
RangerCoder99

Thank you, I knew some of them but I learned something new and usefull from reading this!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome.

Collapse
 
adegbengaagoro profile image
Agoro, Adegbenga. B

I think my favorite tip at this point in time is No. 5. Needed a new theme, seen some really nice stuff already. Thanks

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome.

Collapse
 
charitygamble profile image
Charity Gamble

Great tips. I do find the tip for opening files in a new tab interesting as my VS Code has always opened files in a new tab and I never set it to do so. It’s just always done it. 🤷🏻‍♀️

Collapse
 
ishakmohmed profile image
Mohmed Ishak

It's because you're the chosen one.

Collapse
 
prabhukadode profile image
Prabhu

Great ...

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome, dude!

Collapse
 
computergeek profile image
Amrut

Found it helpful, thankyou

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome, Tech Guy!

Collapse
 
inajaralopes profile image
InajaraLopes

Valeu! Muito boa essas dicas!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

😊

Collapse
 
david405 profile image
David Asamonye

Wow, I love these!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Collapse
 
henriquepicanco profile image
Henrique Picanço

I created one snippet of HTML5 with metatags for SEO and social networks. This tip of yours was incredible for my workflow! Thanks for sharing!

Collapse
 
bhanu1776 profile image
Bhanu Sunka

I think "jellyfish-x-retro" vscode theme deserves to be on your list 🚀💖

Collapse
 
szymonzakiewicz profile image
Szymon Żakiewicz

I am so gratefull for number 1!! Thank you!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Yes, it makes your life at least a million times better!

Collapse
 
minhazhalim profile image
Minhaz Halim (Zim)

Thats really helpful,, thanks!!

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome.

Collapse
 
haru256 profile image
Yohei Okabayashi

This article helps me a lot. Thanks.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

You're welcome.

Collapse
 
tomyjusuf profile image
TomyJusuf

really helpful, good job.
And its usefull. i like the themes, and colored comments.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

Thank you.

Some comments have been hidden by the post's author - find out more