● Top 5 VSCode Keyboard Shortcuts

Thu Dec 29, 2022 11:55 am
Clan Leader
Top Dog
Nuke Dev / Coder
3043 Posts
coRpSE
In-Game
Once Human

Most Played:
This week: 161.4hrs.
Total Played: 196hrs.


  
Reputation: 7386.3
votes: 7
Yesterday, I was helping a friend with a project they were working on, and while I watched his screen capture, I noticed that things he was doing was a bit slow and I figured I could help him with the coding and make certain aspects of coding a little bit easier. Just note, I know in the title I put the word "Best", just know that this is an OPINION piece and nothing more, but I would love to hear what you think are the best Keyboard shortcuts for VSCode.

Just know, I am not talking about the basic keyboard shortcuts that everyone should use, Ctrl+C for copy, Ctrl+V for paste, and even Ctrl+A for select all. Those are basic Windows shortcuts that pretty much everything utilizes. These that I mention are specific to VSCode, which is my code editor of choice and is 100% free.
Sort-of like "Command Palette", which anyone that uses VSCode should know.
Windows: CTRL+SHIFT+P
Mac: CMD+SHIFT+P

That one I am giving a freebie since like I said, everyone should know that one if they use this editor. I was going to put in the Mac commands, but unfortunately, I don't have them and I could probably look it up online, but I will just leave that to you to do is you are using a Mac.


  1. Toggle Sidebar:
    This one is good for allowing the max width of the editor. It's just a quick way to toggle between the sidebar open and closed.
    Expand
    To do this is simple, just press the following:
    Windows: CTRL+B

  2. Remove All Trailing White-Spaces:
    Some of you know, especially by some of my previous tutorials/videos, that I really hate white spaces. When coding, especially now with today's editors, there really isn't any reason for it. Well, with VSCode, there is an easy way to remove all white-spaces. In the image below, you can see that I have all the whites spaces highlighted by using the free extension,
    Please login to see this link
    Get registered or Log in
    . This only highlights it, and if I see it, I can remove it by doing the shortcut.
    Expand
    To do this is simple, just press the following:
    Windows: Ctrl + K THEN PRESS Ctrl + X

  3. Multi/Single Line Commenting:
    If you have ever opened up any file, especially PHP files and you see stuff like:

    Code: [ Select all ]

    //Don't edit below


    The beginning // is us commenting out the rest of that line for either notes, or we removed that line of code from running, but is leaving it there for a specific reason.
    Then sometime you will see a block of code that is canceled out using a /* and a */. That is for a multi-line block to be there, just not read/used by the browser.
    Expand

    This one I seem to use quite a bit. All you need to do is highlight what you want commented out, then press one of the following:

    Windows: (Multi-line comment) SHIFT + ALT + A
    Windows: (Single-line comment) CTRL + K + C

  4. Show References:
    This one I use a lot as well, usually trying to figure out where I am using certain functions/variables. To use, you click on what you want to Reference, then click the shortcut. Simple...
    Expand
    To do this is simple, just press the following:
    Windows: Shift+F12

  5. Multi Cursor:
    This one I use a lot as well, But only really used the click shortcut. I just started using the other two in the past 6 months or so.
    Expand
    To do this is simple, just press the following:
    Windows: (CLICK) ALT + Click
    Windows: (UP ARROW) Ctrl + Alt + Up Arrow
    Windows: (DOWN ARROW) Ctrl + Alt + Down Arrow




So, this is just are probably my top 5 shortcuts that I use within VSCode. If you use this program, do you have any shortcuts that makes your work faster or easier? If so, PLEASE, post them. I like to hear them and if I am not using them, I may have to start.


Here is a list of posts below that contains tips, tricks, new commands:



Expand
Thu Dec 29, 2022 1:00 pm
Spammer
132 Posts
Zardos
Currently Offline
Offline
  
Doesn't like playing games!
Reputation: 917.8
I am no coder, but have started to use VScode to play around with a few things, its good. Now even better with the above, thanks coRpSE.
Thu Dec 29, 2022 8:14 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3043 Posts
coRpSE
In-Game
Once Human

Most Played:
This week: 161.4hrs.
Total Played: 196hrs.


  
Reputation: 7386.3
votes: 7
No problem.  daumen rauf  daumen rauf  2 daumen hoch  daumen rauf  daumen rauf


 
Fri Dec 30, 2022 5:02 am
Nuke Dev / Coder
101 Posts
Lonestar
Currently Offline
Offline

Most Played:
This week: 130.8hrs.
Total Played: 541hrs.


  
YOU NEED A LIFE!
Reputation: 769.7
I use this everyday and did not even know about half of these lol, great post coRpSE lachen


Expand
Fri Dec 30, 2022 5:21 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3043 Posts
coRpSE
In-Game
Once Human

Most Played:
This week: 161.4hrs.
Total Played: 196hrs.


  
Reputation: 7386.3
votes: 7
— Lonestar wrote
I use this everyday and did not even know about half of these lol, great post coRpSE lachen


Thank you.
Some of these I learned when I was watching a video of some guy coding something, I forgot what he was coding. I was more watching it for the VSCode, seeing what others were using for plugins and what not, then I saw him do the multi cursor so fast, (I only knew about the Alt + Click), and I had to learn more, so I did some digging and found various post out there which is where I learned of these shortcuts. I'm thinking about making a printable shortcut cheat sheet with all the commands that I know and use. May also look online for others and just combine them into one.


 
Mon Jan 02, 2023 10:09 pm
Original Poster
Clan Leader
Top Dog
Nuke Dev / Coder
3043 Posts
coRpSE
In-Game
Once Human

Most Played:
This week: 161.4hrs.
Total Played: 196hrs.


  
Reputation: 7386.3
votes: 7
Here is another one that I have just started using a couple of weeks ago. I don't use it often, thats why it didn't make it into the first post. Also, I wasn't sure how I was going to record how to use it.

This one is called "Global Search". To use this, you need to have it opened the project folder, and not just the file. In this animated gif, I put in how to open a project first, might it be just your module, script, or in my case, the root of my current local.

Expand

Once your project is open, find what you need to find every instance of, and press the following:
Windows: CTRL + SHIFT + F

You will see a status bar above the search, once done, you will see a list of all occurrences within the project folder, and you can click on the file on the left to open that file in the main editor section. I hope this helps a bit, I know it does for me.


 
Forums ©