This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

Useful shortcuts tips tricks to speed workflow in VS Code

Daniel Walter Scott

Download Exercise Files Download Completed Files

Contents

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Introduction

I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link: https://www.bluehost.com/track/byol/byol_webess_69

Comments

Video transcript

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 this is like one video with all the things in one little place.

Our first little shortcut is going to be the way to select kind of Parent tag. I'm going to click in the drop-down menu, I've clicked in the word 'On Site'. So on a Mac it's 'Command-Ctrl-Shift', it's kind of like a weird shortcut but worth learning. So 'Command-Ctrl-Shift', on a Mac, if you're on a PC it's 'Ctrl Alt', hold both of those down. So hold them down, and you use the right arrow, and you can see it expanded, before, my selection was flashing in the inside here, it expands out to grab the word. Hit the right arrow again, this is like keyboard arrows that are 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, go right again, grabs a Div, grabs the whole line, grabs the-- all the way there, grabs the drop-down. So it's just a good expanding--

You can use the left arrow to come back in. 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 either delete it, or wrap it with another tag. So 'Command-Ctrl-Shift' on a Mac, and on a PC it is just 'Shift Alt', and then use that little arrow key to the right, and then left, if you need to go back in. 

Helpful tip number one, helpful tip number 2 is Collapsible Line. So if you hover over there, can you see, these things appear. It means that I can say-- actually, let's just close down the Head, hover above it, see this line here, you can see it kind of opens there, and kind of closes at the Head. If I click on the little minus, it just kind of collapses it. I can close the body, and I just get a nice little simple HTML page. So really handy if you're like, "I'm not working on the Head so I'm going to close that down." "I'm not working on the Main, I'm just working on these cards." Not the testimonials, just keep everything tidy. They're all there, you'll see the code doesn't disappear, goes from 58 to 68, just kind of collapses it. You can do the same for this if you've got some really long stuff. I never really do it on my CSS, but yeah, code collapsing, helpful. 

Tip number three is updating all occurrences of something. Let's say that - I'm going to twirl all this down - is let's say Nav Button, I've spelled it wrong, or I want to change it. So over here in Nav Button I'm going to do a Find, so 'Command F' on a Mac. 'Control F' on a PC, and Nav Button. So that's not really the shortcut, 'Command F' is just under 'Edit', 'Find'. So I found my Nav Button, and let's say that I've spelled it wrong. So upper and lower case is very important. You can't use upper over here and then lower in your HTML, they won't match up. 

Sometimes people would like to use this stuff called Camel Case, where it kind of starts low and then gets big in the middle. I love Camel Case, great word. 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. Then I'm going to delete it, then I'm going to take the proper version. So a quick way of updating them all, 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 'Ctrl D' on a PC, and just jumps down, remember, and grabs the next occurrence of that, because sometimes you don't want to change the whole document all at once, you want to go, "All right, I'm just going to change this hash tag, but for these three, not for all of them." It's not a hash tag, just the pound sign the Command D, D. Just a quick easy way to grab them all and say, "Okay, now it's going to go to the 'Contact Us' page." That's a quick easy way, but we've done that before, that is tip number three, let's get on to fourth. 

This next trick is a way to kind of save all the hassle, we forget, I forget all the time to actually save these two documents. So the 'File', 'Save All ',and you go in, you're testing, your like, "Oh, it's not working," and then you forget you haven't saved. So let's say that we want to update this Nav Link here. So what we can do is we can turn File on and turn on, actually be in VS Chrome, and go to Autosave. Now if I change this, watch this, I'm going to make it all upper case. Make it upper case, even, Book Online. You can see it's just slowly but surely, always auto saving. Same when I go and change this H1 here. Where is my H1? I'm going to make him a color of, I'm going to make him black. Putting my semicolon, it's automatically saving and updating. 

Auto saving, I'll leave on for the rest of this course. I'm going to turn off the changes I've done, so I'm undoing. Undo is 'Edit', 'Undo'. And it's already saved, I didn't have to do anything. Let's make this full screen again and get on to the next. The next one's called Zen Mode. 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', and then remember that shortcut, it's one worth writing down. On a Mac it's 'Command K', then 'Z', on a PC it's 'Ctrl-K-Z'. So this, ah, feel the zen. 

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 got to hit 'Esc' key, in the top left of your keyboard twice, weirdly. Double tap that and you come back out. Now that shortcut, 'Command-K-Z' is a weird one. We don't see too many programs that use shortcuts that way. So the way it works is, it's not 'Command K', and then continue holding 'Command Z'. You've got to let go of the 'Command', so watch this. Same for a PC, you hold down either your 'Command' on a Mac, 'Ctrl' on a PC, tap 'K'. It kind of starts all the shortcuts going, and it's waiting for the second thing.

There's a few different ones, 'Command K' is for a lots of shortcuts, gets you going. Then you've got to let go the 'Command key' and hit 'Z'. You can't wait for so long while you're chatting, 'Command K', and then hit 'Z'. So you can't hold the Command key, and tap both of those keys. Same with the Ctrl key on a PC, you get what I mean? How do we get out, 'Esc', 'Esc', no more Zen. 

Next one is going to be Breadcrumbs. So let's click inside of my Nav Button drop-down. I'm going to go to 'View', and I want to turn on 'Breadcrumbs'. Where are you? Down the bottom there. Breadcrumbs appear on 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. So 'Command -', on my keyboard, that's probably how yours is looking. So it's 'Ctrl -' on a PC, 'Ctrl +' to zoom in, to make your code bigger and smaller, depending on what you need. 

I'm going to leave mine about that big. So it tells me I'm inside of an A-tag, which is inside a Div called Nav Button, which is inside a Div called drop-down. We've made it quite clear in here, but often, A, you are not as funny about making everything spaced out nicely, so it's not as easy to see. So if I wanted to style this thing here, I could say I want a Compound Selector, that's styling the Div drop-down, and the Div button that's inside the A-tag. That's Breadcrumbs, we'll leave it on or off for the rest of it, I'm not sure. I use it sometimes, it depends, if it's my own site, often don't. Either a site I haven't worked on for a long time, I'm like, "I don't even know I've built this thing, how it's constructed.", or it's just really messy down here. So that's Breadcrumbs. 

Another cool one for longer documents is under 'View', and it's this one called Mini Map. I'm going to split my screen again, so I put the styles over here. I've got my HTML over here, you get a Mini Map for both panels. That's all it is, is the Mini Map, it's very clear what it does. You can see, for this 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, seriously, ours is pretty small. 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, when I get down to the Footer. I don't need it for the moment, because my website is not big enough. So I'll turn the Mini Map off.
 
So that's it for like the ones you haven't seen before. I'm going to cover the ones that you have, just so that they're all in one place. Wrapping tags, we've done this with varying success throughout the course. So this drop-down here, I want to wrap this entire Tag. I'm going to start with one of my shortcuts. 'Ctrl-Command-Shift', and the right arrow till I grab the whole drop-down. So we learned that one already, remember, that's 'Ctrl-Alt', 'right arrow' on a PC. So I'll grab the whole thing and then I'm like, "I want to wrap it all up", and on a Mac it's 'Command-Shift-P', and you get our command line. Actually it's called the Command Palette here. So that's the shortcut there. On a PC, 'Command Palette', I'm assuming it's 'Control-Shift-P' on a PC, but have a little look, under 'View, 'Command Palette'. And we want Wrap, 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 Emmet code in here, so you don't have to write div class= 

You can do some of the wrap it up in my new box. You can see it down here, it's all inserting it, it's lovely. Now there are other things you can get that Command Palette to do. I just use the Wrap tag very often. Let's have a look, open up 'Command Palette', you can have a little look in here. There's lots of stuff in here that you might decide that it's easier, instead of trying to figure out what the drop-down menu, sorry, shortcut from this menu is, you can actually go, all right, what do I want in here? Let's say I want to, Save All, because I can't think of a good one off the top my head. So you want to do Save All, and you don't want to use the shortcuts, what you can do is you can say, 'Command-Shift-P', and then do Save All', and that's-- it's running the same command as clicking on this. 

So a lot of developers will like doing that method. The cool thing about it is, if I go back into it, you can see, it's the last, recently used stuff. It means that I don't have to go and type it in and find it again. I can just go 'Command P' and hit 'Save All', and that's working. Multi cursors, we've covered. In my Mac, at the moment it is set to-- you can toggle this, but under Selection you've got, it will either be 'Command' click on a Mac, or in my case, it's 'Option' click for multi cursor. On a PC it's the Alt key, so Option on a Mac, Alt on a 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 cursor flashing there. I also want to add it to this one for no good reason, then I'll add it for this one, and I'm going to type in 'Class', and you can see, it's applying it to all of these things. So multi cursor, helpful. Another really handy one, and instead of doing multi cursor, where you've got to kind of like, oh, hold down the Option key, and click, click, click, you got to be very specific with your mouse. You actually have to be using your mouse. All the time when I'm coding I don't want to touch the mouse, I just want to kind of use all my keyboard shortcuts. 

So let's say that I want to add-- change this hash tag, so I'm going to click on it, and I'm going to, on a Mac, hold down 'Command Option', and hit my down arrow twice. So now I can go through and do Contact Us. We've done that a few times but there's times where you need this, maybe the Command D, or Ctrl D on a PC. On a PC it's a very similar thing. You click where you want to start, hold down the 'Alt' key and 'Ctrl' key, and hit the down arrow. I've done it twice, and you get multi cursors. 

The last two, cleaning everything up. If you've got bits all over the place, and indentation's not quite working, and you're like, "I wish I had this all kind of cleaned up", 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. And it just tidies everything up, makes it all look indented. It doesn't 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. 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. 

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, select it all, format it, so I can at least see some sort of structure. And the last one is Word Wrap. Turns off every time, get it back on, just so that the lines break on the edge here, not kind of towards the end of the line, but you end up with these funny gaps over here, it's up to you. That's it for our speeding things up tips and tricks cheat sheet. I stuffed 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, that's still just painful," then it was never meant to be. It's a shortcut you were 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 I'm coding", and "I can use that extra time to do another one of Dan's courses." That's what you'll do. All right, I'll see you in the next video.