Useful Shortcuts and Tips in VS Code
Good morning everyone. This video is going to be like a tips and tricks video. We're going to look at cool shortcuts that we haven't covered before. Plus at the end of this video I'll throw in the ones we have covered. Just so there's like one video with all the things in one little place. Our first little shortcut is going to be the way too slick kind of parent tags. So I'm going to click on the dropdown menu. I've clicked in the word on site so on a Mac it's command control and shift. It's kind of like a weird shortcut but worth learning. Okay, so command control shift on a Mac and if you're on a pc it's control and hold both of those down. Okay, so hold them down and you use the right arrow and you can see it expanded for my selection was flashing in the inside here, it expands out to grab the word. Hit it, hit the right arrow again. This is your like keyboard arrows on your keyboard. So it again grabs everything inside of that tag. Go one more it grabs the parent of that whole tag ...
which is my A and right again grabs the div the whole line, grabs the all the way they're here, grabs the drop down so it's just a good expanding. Okay, you can use the left area to come back in so often if you want to grab the whole drop down, you just kind of click in there and smash away until you grab the whole thing and then you can eat it deleted or wrap it with another tag. Okay, so command control shift on our neck and on a pc it is just shift and salt and then use that little arrow key to the right and then left if you need to go back in. Alright, helpful tip number one, helpful, tip number two is collapsible line. So if you hover over there, can you see these things appear okay? It means that I can say actually let's just close down the head. So hover above and see this little line here. It'll, you can see it kind of opens there and kind of closes at the head. If I click on the little minus it, just just kind of collapses it. Okay, you can close the body and I just get a nice little simple html page. Okay, so really handy if you're like, okay, I'm not working on the head so I'm going to close that down. Okay. I'm not working on the main, I'm just working on these cards. Okay, not the testimonials. Just keep everything tidy. They're all there. Okay? You can see the code doesn't disappear. It goes from 40 58 to 68. Just kind of collapses it. Okay, you can do the same for this if you've got some really long stuff. I never really do it on my CSS and beer code collapsing. Helpful. Alright, tip number three is updating all occurrences of something. Let's say that I'm going to twirl all this down. Okay is let's say never button. I've spelled it wrong or I want to change it. So over here in native button, I'm going to do a fine. So command F on a Mac control F on our Pc and nav button. So that's not really the shortcut command F. Or it's just under edit find. Okay. So I found my nav button and let's say that I've spelled it wrong. Um So upper and lower case is very important. Okay, you can't use upper over here and then lower in your html. They won't match up. Okay. And sometimes people like to use this stuff called camel case. Okay. Where it kind of starts low and then gets in the middle. I love Campbell case. Great word. But let's say I've changed it here. It needs to update over here. So what I can do is just find one of them and I know it's throughout this page. So I'm going to right click it and say let's just change all occurrences. Okay? And then I'm gonna delete it and then I'm going to tape the proper version. So a quick way of updating them all. Okay, I'm going to undo that because I don't want to wreck it. The other thing we might do is it's tied to this. We've learned it before is to click one and hit command D. Or control D. On a Pc and just jumps down, remember and grabs the next occurrence of that because sometimes you don't want to change them whole document all at once. You want to go All right. I'm just going to change this hashtag but for these three not for all of them. Okay sort of hashtag. Okay. Just the pound sign. But command D. D. Okay. Just a quick easy way to grab them all and say okay now it's going to go to the contact us page. Okay. That's a quick easy way. But we've done that before. That is tip number three. Let's get onto fourth. Okay. This next trick is a way to kind of save all the hassle we forget. Okay. I forget all the time to actually save these two documents. Okay. So the file save all. Okay. And you go in your testing, you're like, oh it's not working and then you forget you haven't saved. Okay. So let's say that we want to update this knave link here. Okay. So what we can do is we can turn file on and turn on. Okay. Actually be envious chrome and go to auto save now if I change this, watch this, I'm going to make it all uppercase uppercase even book online. Okay? You can see it's just slowly but surely always auto saving. Okay. So when I go and change his H one here, where's my age one? I'm going to make him a color of, I'm going to make him black. Okay putting my semi colon it's automatically saving and updating. All right. What I said, I'm going to leave on for the rest of this course. I'm going to turn off the changes I've done so I'm undoing. Okay, undo. Edit undo. Alright. And it's already saved that. Have to do anything. Alright, let's make this full screen again and get on to the next tip. The next one's called zen mode. Okay? You're coding. You don't need all this junk and everything else. What you can do is you can go to view and you can go to appearance and you can go to zen mode. Okay? And then remember that shortcut? It's one worth writing down. Okay. On a Mac. It's command K. Then Z. Ok. On a pc. It's control KZ Okay. So this ah you feel the zen? Okay. Full screen. Get lots more space for my code and I've removed all the kind of panels on the side to get out of it. You gotta escape key on the top left of your keyboard twice. Weirdly. Okay, double tap that. And you come back out now. That shortcut command K's is a weird one. Okay. We don't see too many programs that use shortcuts that way. So the way it works is it's not commands command K. And then continue holding command Z. You've got to let go of the commands watch this. Same for a pc. You hold down either your command on a Mac control on a pc tap K. That kind of starts all the shortcuts going and it's wakey waiting for the second thing and there's a few different ones. Command K. Is for lots of shortcuts gets it going, then you gotta let go of the command key Z. Okay? You can't wait for something while you're chatting command K. And then hit Z. Okay so you can't hold the command key and tap both of those keys, saying with the control key on a pc, you know what I mean? How do we get out? Escape? Escape no more. In the next one is going to be breadcrumbs. Okay so let's click inside of my Nav button. Drop down. Okay? And I'm going to go to view and I want to turn on bread crumbs. Where are you down the bottom there? Okay, breadcrumbs appear along the top and it's really handy when you are trying to build like compound selectors to kind of know where you are in the world. I'm going to close this down so I can see my complete breadcrumbs. My text is quite zoomed in. It's a command minus on my keyboard, that's probably how yours is looking. So it's control minus on a pc controlled plus to zoom in code bigger or smaller depending on what you need. I'm gonna leave mine about that big so it tells me that I'm inside an a tag which is inside our div called Nav button which is inside a difficult dropdown, we've made it quite clear in here but often a you're not as funny about making everything spaced out nicely so it's not as easy to see. Okay, so if I wanted a stylist thing here, I could say I want a compound selector that's starting the div drop down and the div button that's inside the A tag. Alright, that's breadcrumbs, we'll leave it on or off for the rest of it. I'm not sure I use it sometimes, depends if it's my own site often don't either aside, I haven't worked on for a long time and I'm like I don't even know who built this thing or how it's constructed or it's just really messy down here. So it's breadcrumbs. Another cool one for longer documents is under view and it's this one called mini map. Okay, so I'm going to split my screen again. So and I put the styles over here and I've got my east email over here, you get a mini map for both panels and that's all it is is the mini map. It's very, very clear what it does and you can see for the CSS it's quite a long page so it means I can jump to the bottom instead of scrolling like ours is not too big, like seriously ours is pretty small. Okay, you can like you'll get into huge websites with loads and loads of code so you can just use the mini map to kind of scroll through. Same with here, I want to get down to the footer. Okay, I don't need it for the moment because my website, it's not big enough. So I'm gonna turn the mini map off. Alright, so that's it for like the ones you haven't seen before. I'm going to cover the ones that you have just that they're all in one place wrapping tags. We've done this with various success throughout the course. Okay, so this drop down here, I want to wrap this entire tag, I'm gonna start with one of my shortcuts. Control command shift and the right arrow until I grab the whole drop down. Okay, so we learned that one already. Remember that control alt, right arrow on a Pc. Okay, so grab the whole thing and then I'm like okay you want to wrap it all up and on Mac, It's command shift P. Okay, And you get our command line actually it's called the command palette here. Okay, so that's your shortcut there on a PC command palette or I'm assuming it's control shift piano, pc but have a little look under view command palette so and we want rap. Okay, And click on it and then I can wrap it up in something. So I'm going to put it in a new Div tag, you can use your Emmett code in here so you don't have to write div class equals. Okay, you can do something to wrap it up in my new box. Okay. You can see it down here. It's all in setting it it's lovely. Now there are other things you can get that command palette to do. I just use the rap tag very often. So let's have a look open up the command palette. You can have a little look in here. There's lots of stuff in here. Okay. That you might decide that it's easier instead of trying to figure out what the dropdown menu, you know what they're sorry shortcut is from this menu is you can actually go all right. What do I want in here? Let's say 12 mm hmm. Save all because I can't think of a good one off the top of my head. So you want to use a ball and you don't want to use the shortcuts. Okay. What you can do is you can say all right, command shift P. Okay. And then do save all and that's it's running the same command is clicking on this. So a lot of developers would like doing that method and the cool thing about it is if I go back into it, okay, you can see it's the last all this recently used stuff. Okay. It means that I don't have to go and type it in and find it again. I can just go command P and then hit save all and that's working multi curses. We've covered. Okay, in my Mac at the moment it is set to, you can toggle this okay? But under selection you've got it'll either be command click on a Mac or in my case it's option collect for multi cursor on a pc. It's the key so option on the mac alterna pc and it means that I can put in lots of different ones. So I'm going to add a class here so I want the curse of flashing there. I also want to add it to this one for no good reason and I'll add it for this one and I'm going to type in class. Okay? And you can see it's applying it to all of these things. So multi cursor helpful. Another really handy one. Instead of doing multi cursor where you got to kind of like oh hold down the option key and click click click. You gotta be very specific with your mouse and you actually have to be using your mouse a lot of the time when I'm coding. I don't want to touch the mouse, I just want to kind of use on my keyboard shortcuts. So let's say that I want to add change this hashtag Okay so I'm going to click on it and I'm going to on a Mac, I'm gonna hold down command and option and hit my down arrow twice. Okay So now I can go through and to contact us. We've done that a few times but there's times where you need this may be the command D. Or control D. On a pc. On pc. Okay? It's a very similar thing. Okay? You click where you want to start hold down the old key and the control key and hit down arrow. I've done it twice. Okay. And you get multi curses the last two cleaning everything up. If you've got bits all over the place and the indentation is not quite working and you're like, I wish I had this all kind of cleaned up. Okay? You can easily grab it all and go to right click and either go you can format the whole document but it's probably more common just to format the selection. Okay? And it just Heidi's everything up. Makes it all look intended, it doesnt match everything you can see it kind of pushed it along to the edge here. So when you are doing the whole thing, you might select the whole chunk and do that format selection. Okay. Does change it a little bit from what you might have naturally wanted it to be. You can see it's done some it's all indented nicely. Okay. I find when I'm opening up maybe it's a document somebody else is working on or it's a template and it's a big mess. First thing I do selected all formatted so I can at least see some sort of structure and the last one is word wrap turns off every time going back on just so that the lines break on the edge here, not towards the end of the line, but you end up with these funny gaps over here, it's up to you and that's it for our speeding things up tips and tricks cheat sheet. Okay, I stuff the keywords into that title, but I hope you found some useful stuff and like all good shortcuts, they only work if you practice them for a little while, so maybe pick one or two of those a day and go, okay today, I'm going to do the multi cursor day and just do it, do it, do it. And at the end of a couple of days, if you're like, man, it's still just painful then it was never meant to be. It's a shortcut, you are never meant to remember and just pick another one and go, all right, I'm going to do that one today because it's going to incrementally save me a little bit of time each and every day when I'm coding and I can use that extra time to do another one of dance courses. That's what you'll do. All right. I'll see you in the next video