Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 27, 2021 03:28 pm GMT

14 VS Code Shortcuts to Supercharge Your Productivity

We, software engineers, tend to be extremely efficient beings.

Our goal is to optimize everything, not just the code.

That's why we don't want to spend 10 seconds looking for something on the GUI. We don't want to spend even 2 seconds.

Why would we, when we can do it in 0,1s by using the powerful keyboard shortcuts?

If I repeatedly do the same actions, I always Google for its shortcut. Usually, I find it.

Let me share with you the shortcuts I use every day. I bet you don't know many of them!

1. Search files byname

Ok, we'll start by listing the most common and simples shortcuts.

cmd + P (Mac) / crtl + P (Windows) will open a search field with an incredibly powerful fuzzy search. I probably use this 100+ times a day.

2. Searchsettings

This one is similar; after clicking cmd + P (Mac) / crtl + P (Windows), just type >. You can now type in any search term, and only settings will be affected.

3. Multiplecursors

This feature is so cool, I wish I could use it everywhere else!

Just press alt and start clicking around the editor. Multiple cursors will appear!

4. Multiple cursorsv2

You can do something similar without clicking around. cmd option + arrow down (Mac) / shift alt + arrow down (Windows) will insert an extra cursor below.

Obviously, you can use arrow up to insert a cursor above.

5. Select all occurrences

This one is quite uncommon, but it's extremely powerful! First, you need to select some text.

Then,cmd shift + L (Mac) / crtl shift + L (Windows) select all occurrences of that text. It's so useful for situations like renaming a variable across the file:

Imagine manually renaming a variable repeated 30 times in the file. Nightmare.

6. Delete aline

cmd shift + K (Mac) / crtl shift + K (Windows) does the trick here.

7. Duplicate aline

Put your cursor in the line you want to duplicate.

Press cmd + C, then cmd + V (Mac) / crtl + C, then crtl + V (Windows). Voila!

8. Search in afile

This one is quite familiar across all the common apps (like browsers): cmd + F (Mac) / crtl + F (Windows).

cmd + G (Mac) / crtl + G (Windows) search for the next occurrence, while cmd shift + G (Mac) / crtl + shift + G (Windows) search for the previous one.

9. Replace in afile

If you want to replace the term you searched for, fire cmd option + G (Mac) / crtl shift + G (Windows).

Then, click enter to replace the current occurrence.

If you want to replace them all, click cmd + enter (Mac) / crtl + enter (Windows).

10. Search in allfiles

Nothing can exist without a good old search in all files.

cmd shift + F (Mac) / ctrl shift + F (Windows) does the trick.

If you want to match text by case, press cmd option + C (Mac) / crtl shift + C (Windows).

You can also match the whole word by pressing cmd option + W (Mac) / crtl shift + W (Windows).

11. Replace in allfiles

Do you want to replace all occurrences in all files across the project, i.e. search/replace?

Amazing, cmd option + H (Mac) / crtl shift + H (Windows) does the trick.

cmd option + enter (Mac) / crtl alt + enter (Windows) triggers the replacement.

12. Spliteditor

One tab is not enough, you need many of them! Great, just press cmd + \ (Mac) / alt shift + 0 (Windows). Repeat until you're satisfied.

13. Closetab

This one is the same as in Chrome-cmd + W (Mac) / crtl + W (Windows).

14. Switching between openedtabs

Do you want to open the previous tab? crtl + tab does the trick.

Do you want to go to a tab on a known position? crtl + [index] does that.

Finally, you can pick the tab on left/right by pressing cmd option + arrow left/right (Mac) / crtl page down/up (Windows).

Conclusion

I wouldn't suggest learning all of them by heart immediately - try with one or two of them, and slowly adapt them to your work.

Save this article in case you want to revisit it later.

Using more keyboard shortcuts will increase your productivity.

And oh, it does feel so good.


Original Link: https://dev.to/domagojvidovic/14-vs-code-shortcuts-to-supercharge-your-productivity-4khn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To