TubeSum ← Transcribe a video

VS Code for Beginners: The Ultimate Collection of Tips & Tricks

0h 17m video Published Jan 21, 2022 Transcribed Aug 2, 2026 A Alex Hyett
Beginner 8 min read For: Beginners to Visual Studio Code who want to learn essential tips and tricks to improve their coding workflow.
AI Trust Score 70/100
⚠️ Average / Some Fluff

"Delivers a solid collection of tips and tricks, though the 'ultimate' claim is a stretch; it's a good beginner overview."

AI Summary

This video is a beginner-friendly guide to Visual Studio Code, presenting a collection of tips and tricks to enhance productivity. The presenter demonstrates how to open projects, use keyboard shortcuts, edit multiple lines simultaneously, leverage built-in features like Emmet and snippets, and integrate Git, all aimed at helping viewers use VS Code more efficiently.

[00:02]
Opening Projects in VS Code

Use the terminal command 'code .' to open the current folder in VS Code. If the command isn't recognized on macOS, install it via Command Palette (Shift+Cmd+P) and selecting 'Shell Command: Install code in PATH'.

[01:25]
Keyboard Shortcuts Reference

Access a printable keyboard shortcuts reference via Command Palette (Shift+Cmd+P) and typing 'keyboard shortcuts'. This provides a list of shortcuts for your specific OS.

[01:59]
Quick File Navigation

Use Cmd+P (Ctrl+P on Windows) to open the file search. Type a filename to jump to it. You can also navigate to a specific line by typing ':' followed by the line number (e.g., ':38').

[02:53]
Navigating to Symbols

Use Cmd+P and type '@' to list all functions, methods, and symbols in the current file. Select one to jump directly to its definition.

[03:20]
Multi-Cursor Editing

Use Cmd+D (Ctrl+D on Windows) to select the next occurrence of the current selection, allowing simultaneous editing. Alternatively, use Alt+Click (Option+Click on Mac) to place multiple cursors manually.

[04:33]
Column Selection

Hold Alt+Shift (Option+Shift on Mac) and drag to select multiple lines vertically, enabling you to edit several lines at once, useful for CSV files or adding spaces.

[05:30]
Rename Symbol

Use 'Rename Symbol' (F2) to rename a variable or method across the entire project safely, updating all references without affecting unintended occurrences.

[06:08]
Cut, Copy, and Move Lines

Use Cmd+X (Ctrl+X) to cut the entire line without selecting it. Use Alt+Up/Down (Option+Up/Down) to move a line of code up or down.

[07:15]
Commenting Code

Select code and press Cmd+/ (Ctrl+/) to comment or uncomment the entire selection quickly.

[07:42]
Tab Management

Use Ctrl+1, Ctrl+2, etc., to switch between tabs. Pin tabs by right-clicking and selecting 'Pin' to keep them open even when closing others.

[08:50]
Navigate Back

Use Ctrl+- (Cmd+- on Mac) to jump back to the previous cursor position, useful for navigating between files.

[09:16]
Code Snippets

Type a snippet prefix (e.g., 'switch') and select the suggestion to auto-generate code. Create custom snippets via Command Palette > 'Configure User Snippets'.

[10:52]
Emmet

Use Emmet abbreviations in HTML files to generate markup quickly. For example, type 'html' and press Enter to create a basic HTML structure, or 'li*5' to create five list items.

[11:59]
Creating Files with Nested Folders

In the Explorer, right-click and select 'New File', then type a path like 'model/weather.cs' to create the folder and file simultaneously. Use Cmd+N for a new file, and set a default language via settings.

[13:57]
Command Palette and npm Scripts

Use Cmd+Shift+P to open the Command Palette. Type 'npm' to see options like 'npm run script', which lists all scripts in package.json for easy execution.

[14:28]
Integrated Terminal

Open the integrated terminal with Ctrl+` (backtick). You can have multiple terminals, split them, and switch between different shells like zsh or PowerShell.

[15:25]
Git Integration

Use the Source Control icon to manage Git operations via a UI. You can stage, commit, and push changes without using the command line. The GitLens extension adds inline blame annotations.

The video provides a comprehensive set of VS Code tips and tricks that are essential for beginners to improve their coding efficiency. By mastering these shortcuts and features, users can significantly speed up their workflow and make the most out of the editor.

Mentioned in this Video

Tutorial Checklist

1 00:16 Open a project in VS Code by typing 'code .' in the terminal. If the command is not recognized on macOS, install it via Command Palette (Shift+Cmd+P) > 'Shell Command: Install code in PATH'.
2 01:25 Access the keyboard shortcuts reference by opening the Command Palette (Shift+Cmd+P) and typing 'keyboard shortcuts'.
3 01:59 Use Cmd+P (Ctrl+P) to quickly find files. Type a filename to jump to it, or type ':' followed by a line number to go to a specific line.
4 02:53 Use Cmd+P and type '@' to list all symbols in the current file and jump to a function or method.
5 03:20 Edit multiple occurrences at once by selecting text and pressing Cmd+D (Ctrl+D) repeatedly, or use Alt+Click (Option+Click) to place multiple cursors.
6 04:33 Select multiple lines vertically by holding Alt+Shift (Option+Shift) and dragging the cursor.
7 05:30 Rename a symbol safely by placing the cursor on it and pressing F2, then typing the new name.
8 06:08 Cut a whole line with Cmd+X (Ctrl+X) without selecting it, and move lines with Alt+Up/Down (Option+Up/Down).
9 07:15 Comment or uncomment code by selecting it and pressing Cmd+/ (Ctrl+/).
10 07:42 Navigate between tabs using Ctrl+1, Ctrl+2, etc. Pin important tabs by right-clicking and selecting 'Pin'.
11 08:50 Jump back to previous cursor positions with Ctrl+- (Cmd+-).
12 09:16 Use code snippets by typing a prefix like 'switch' and selecting the suggestion. Create custom snippets via Command Palette > 'Configure User Snippets'.
13 10:52 Use Emmet abbreviations in HTML files, e.g., type 'html' and press Enter, or 'li*5' to create five list items.
14 11:59 Create files with nested folders by right-clicking and selecting 'New File', then typing a path like 'model/weather.cs'.
15 13:57 Use the Command Palette (Cmd+Shift+P) to run npm scripts by typing 'npm run script'.
16 14:28 Open the integrated terminal with Ctrl+` (backtick). Split terminals using the split icon.
17 15:25 Use the Source Control icon to manage Git operations via the UI. Install GitLens for inline blame annotations.

Study Flashcards (23)

How do you open the current folder in VS Code from the terminal?

easy Click to reveal answer

Type 'code .' in the terminal.

00:44

What is the keyboard shortcut to open the Command Palette?

easy Click to reveal answer

Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows).

01:25

How do you quickly find a file in VS Code?

easy Click to reveal answer

Press Cmd+P (Ctrl+P) and type the filename.

01:59

How do you navigate to a specific line number in a file?

medium Click to reveal answer

Press Cmd+P and type ':' followed by the line number (e.g., ':38').

02:26

What does the '@' symbol do in the file search (Cmd+P)?

medium Click to reveal answer

It lists all symbols (functions, methods) in the current file for quick navigation.

02:53

How do you edit multiple occurrences of a word at once?

medium Click to reveal answer

Select the word and press Cmd+D (Ctrl+D) repeatedly to select each occurrence, then type to edit all.

03:20

What is the shortcut to place multiple cursors manually?

medium Click to reveal answer

Alt+Click (Option+Click on Mac) on each location where you want a cursor.

03:48

How do you select multiple lines vertically?

medium Click to reveal answer

Hold Alt+Shift (Option+Shift) and drag the cursor up or down.

04:33

What is the safe way to rename a symbol across the project?

medium Click to reveal answer

Use the 'Rename Symbol' feature (F2) which updates all references.

05:30

How do you cut an entire line without selecting it?

easy Click to reveal answer

Place the cursor on the line and press Cmd+X (Ctrl+X).

06:08

How do you move a line of code up or down?

easy Click to reveal answer

Press Alt+Up or Alt+Down (Option+Up/Down on Mac).

06:34

What is the shortcut to comment or uncomment a selection?

easy Click to reveal answer

Cmd+/ (Ctrl+/ on Windows).

07:15

How do you switch to a specific tab in VS Code?

easy Click to reveal answer

Press Ctrl+1, Ctrl+2, etc., to switch to the corresponding tab.

07:56

How do you pin a tab in VS Code?

easy Click to reveal answer

Right-click on the tab and select 'Pin'.

08:23

How do you jump back to the previous cursor position?

medium Click to reveal answer

Press Ctrl+- (Cmd+- on Mac).

08:50

How do you create a custom snippet in VS Code?

medium Click to reveal answer

Open Command Palette, type 'Configure User Snippets', and edit the snippet file.

09:42

What is Emmet and how is it used?

medium Click to reveal answer

Emmet is a built-in tool for generating HTML/CSS code using abbreviations, e.g., 'li*5' creates five list items.

10:52

How do you create a new file in a nested folder?

medium Click to reveal answer

Right-click and select 'New File', then type the path like 'model/weather.cs'.

11:59

How do you set a default language for new files?

hard Click to reveal answer

Add 'files.defaultLanguage' to settings and set it to 'activeEditorLanguage' or a specific language.

12:56

How do you run npm scripts from VS Code?

medium Click to reveal answer

Open Command Palette and type 'npm run script' to see and run scripts from package.json.

13:57

What is the shortcut to open the integrated terminal?

easy Click to reveal answer

Ctrl+` (backtick).

14:28

How do you split the integrated terminal?

easy Click to reveal answer

Click the split icon in the terminal panel.

14:56

What does GitLens extension do?

medium Click to reveal answer

It shows inline blame annotations, indicating who last edited a line and when.

17:01

💡 Key Takeaways

🔧

Open project with 'code .'

This is a fundamental command that every VS Code user should know to quickly open projects from the terminal.

00:44
🔧

Multi-cursor editing with Cmd+D

This feature dramatically speeds up editing repetitive code and is a key productivity booster.

03:20
🔧

Rename Symbol for safe refactoring

Using F2 to rename symbols is safer than find-and-replace because it only changes the intended references.

05:30
🔧

Emmet for rapid HTML generation

Emmet saves a significant amount of time when writing HTML, making it an essential tool for web developers.

10:52
💡

Git integration in VS Code

The built-in Git UI makes version control more accessible and reduces the need to switch to the command line.

15:25

[00:02] going to show you a few tips and tricks that i picked up along the way to get you using vs code like a pro so the first thing i want to show you is how to open up your project in vs code and obviously you can just go down and

[00:16] on the terminal i know it's probably the quickest way to do it um so let's say you're going to create a new project so let's create new test proj new folder now there's a couple of ways

[00:30] we can open this up we can do code test proj into that new folder

[00:44] just doing code dot now bs code is opened up and you can start writing code for a new project if you're on a mac like me and that last command didn't work to open up code and

[00:57] that's because it's not on your path and what you can do to do that is to shift command p which will load up the command palette and then type in shell and you command in path click that and you should get a nice

[01:11] message so it's been successfully installed so next time you go and try installed so next time you go and try that command it should work pro then you need to learn the keyboard shortcuts

[01:25] which you can even print out if you want to and you do command shift p this loads up the command palette from there you can do keyboard shortcuts by typing in shortcuts and you'll get a help keyboard shortcuts reference link there and

[01:41] press enter that'll load up the keyboard shortcuts for your frozen system so in my case it's a mac but for you it might be windows and one of the things i'll show you first is how to quickly find a file so

[01:59] if you do command p or control p if you're on windows this will load up the search files window so there you can type in we want to go to i've got a weather

[02:12] through and find particular file results and and go down and go to the one you want to so let's go to the controller scroll up here so here you've got the um file all opened if you want to go to a

[02:26] particular line and you can do command p again and in this case we're going to do and then type the line that you want to go to now this is particularly useful if you've got a really long file um so let's just say we want to go to line 38

[02:40] press enter and your cursor will now be online 38 another cool feature you can do to help you go through the code is again command p this time we're going to do the at symbol

[02:53] the various functions that we've got in this um functions and methods and names that we've got inside this controller um so if you want to go to a function obviously we've only got a get function in this one we're going to get async

[03:07] and that will take us to this get method so vs code lets you edit multiple things at once and there's a few ways of doing that so let's say we've got weather response here now when you double click on

[03:20] for you every single place where that text appears but actually it's possible to edit all of those at once so if we do command d or ctrl d on windows you can see as i click through it's going to highlight

[03:34] items from there if we start typing we will actually edit all of these at once which is pretty cool another way that you can edit multiple things at once is to use the

[03:48] um alt click if you're on windows and this lets you place your cursor in multiple places um so let's say we want to add a comment at the end of each of our our lines of code

[04:02] to hold down option or alt and then click on all the other lines of to and then from here we can just start typing and it's going to edit in all the places

[04:19] need to update a bunch of things at once in different places in your code one thing i do particularly like doing is being able to update is being able to update uh several lines at once um so

[04:33] if you do alt shift or option shift you can actually drag your cursor down um so we pick here we can drag this down hold down alt shift and then drag down the cursor and then we can add in like multiple spaces or whatever you

[04:47] want to do can be done you can even um particularly if i'm editing a csv file you can edit multiple lines at once while we've got the cursor there the other thing you do is obviously you can

[05:01] go through with the arrow keys a character at a time what's more useful is again if you hold down option you can actually jump to the end of each and goes through and jumps to those particular points

[05:15] so previously we edited the response word there and there's a better way of multiple references or something throughout your code so let's say we wanted to edit this get weather async method um

[05:30] there's a great thing you do here it's called rename symbol so this is going to link through all the references in your code and using that it's going to rename so this is much safer to do than say a find and replace

[05:43] which might end up editing something you don't want this will only edit this particular method let's call it get weather async or get get weather now i think um now it's gone through and you can see

[05:56] up here in the unsaved openness it doesn't save it but this has gone and updated the weather client it's updated the forecast with the new method name

[06:08] another cool thing you can do is say you want to cut a line out your code um once you know that control x will do a cut or command x if you're on on a mac and we can take this whole line out you don't

[06:20] copy the whole line you can let you just have your cursor on it do command x and um and obviously you can then paste that where you want it um down here for some reason you can put that in

[06:34] move around a particular line of code and key and then use the arrows and this will move that line of code around for you now one thing i find

[06:49] myself doing especially if i'm trying to debug something or i'm making something you know obsolete is section of code and obviously you can do this just by

[07:02] putting in your comments um for each line and that's a bit slow um or obviously you can do the the shift option or shift alt thing go through and select it but actually there's a shortcut for it now

[07:15] if you select what you want to comment out you can do command forward slash and that will do a complete section for you you can just do that while you want because it's on the line

[07:29] especially at work i'll have 20 million tabs open i find that on the same visual studio code when i'm working on a project i'll have 10 20 different tabs open all pointing to different things now visual

[07:42] studio code gives you a great way to navigate between all those tabs and so let's open up a few more things and i'll show you what i'm talking about one of the things you can do to navigate between all these different tabs is to

[07:56] use control and number now this should work on both windows and on a mac so if we want to go to the first tab to and same for the others control two control three control four

[08:10] tabs is to be able to pin them so say there's open the way we do that is you right click on a tab and you can see down here we've got the option to pin it

[08:23] and now what that means is that it will always be there um so if we were to do here and do close all then we still keep our pin tab open um so it's great thing to just keep those

[08:35] windows there if you want to close a tab that's been pinned and you need to unpin right clicking on pin and then it will allow you to close it now one thing that i find is that i'm often jumping around pieces of code

[08:50] so say we started on our startup page then we want to go back to where we were previously and now you can do that by pressing ctrl minus and that will jump straight back

[09:03] worked on and now you can keep doing this and points which is really cool one feature i use quite a lot is code so the way this works you can basically

[09:16] type in a bit of code and then it will auto complete what you want to type in statement um so let's type switch and now you can see here the the second option um it's a switch statement if you click

[09:30] on that actually auto generate the the main part of your switch statement for you and this works with a lot of different methods now you can write your command shift p

[09:42] and we type in snippets and we can do configure user snippets now there's a global snippets file that works across all instances um or there's one specific to the project that you're working on

[09:56] snippets file here and you can call it what you want i'm just going to call it what you want i'm just going to call it snippets for you and so it already comes with code ready for you to

[10:10] console example um so first we're just gonna uncomment all of this now this particular example is obviously for javascript and typescript and you can change the

[10:24] language scope that you want to use and edit it to what you want i must admit i haven't written many of these snippets myself what i tend to do is go to extensions and from there if you just search for

[10:37] snippets you can then find snippets for all of the top languages and save you a lot of time in and write your own ones html one really good inbuilt feature of vs

[10:52] code is something called emit now i think this used to be an external plugin but now they've basically built it directly into vs code now the way this works is we've got html page here and we want to fill it out so

[11:05] what we do is we'll type html and you can see here we've got an abbreviation now you can just click enter and that will fill out the tags but let's say we want to go a bit more so let's say we want a body

[11:19] on a biddy a body with um with um a div inside it a nested div for you now let's say we want uh another div

[11:32] with an unordered list and you can do li time x5 and that will create five of them for you like that so it's really powerful and it saves a lot of

[11:46] time if you're writing html one thing when you're coding that you're creating new files so we can do that really quickly in vs code so if we right click and do a new file

[11:59] obviously you can type in a new file but say we want that in a nested folder but we can actually type model followed by forward slash and then say let's say weather dot cs and you see that's created our model

[12:15] folder as well as our our weather file this works with multiple nested folders so let's do new file i'm going to type folder and then nested folder

[12:29] let's call it nested nested and then file.json structure as well as our file inside there now another way you can do new files is by doing command n

[12:43] to load up a new window but you can see here that it's just a plain text file constantly working with c sharp or another language and you want the new files that you create to be in the same language there is a setting for that if

[12:56] we go command shift p load up this and then type in settings we can open up our settings file and then the setting you need to add in and then the setting you need to add in is files dot default language

[13:17] the default language if we do command space it will autocomplete and in this case we want to have active editor language now if you language you might just want to set that explicitly

[13:30] but this will use the language that you're currently using on your page so let's get rid of our new file go back to our controller and do command n again and now you can see we have a c sharp file rather than a

[13:44] plain text file so one thing that we've used a lot already but already talked about is the command palette so this is control shift p or command shift p on a mac and here you can search for and execute

[13:57] a lot of the commands that are built into vds code one really cool feature if you're working on a react project or a node project in general is type in npm and here you can see a bunch of options for node but if we do npm run script at

[14:12] this will show all of the options that are in your package.json file instead of having to run them on the command line one of the most useful terminal we can get to that by doing control

[14:28] factic you can see here i'm using zsh as my terminal on a mac um but i can also load up other terminals you can see how i'm and i'll load up multiple terminals and switch between them this is really

[14:42] running in the background but you also need to run as something else and alternatively you can see the other types of terminals that are available to so this will be different if you're running on a on windows as you might

[14:56] have power shell here for example and we can also you can see this little window this little icon here and that allows you to split up your terminals you can see both of them at once another cool feature that i find myself

[15:10] using quite a lot especially on c-sharp projects is to be able to click on a folder and then one here do open in integrated and that's great way to just quickly jump to a particular part of your code

[15:25] lastly one really cool integration with vs code which makes it really useful is it's git integration so you can see here we've got the source control icon it

[15:37] gives you a great ability to use the functionality of git without so yes you can type them straight in on the terminal so we go back to our main folder here

[15:51] and we can type git status and it will tell us that sort a nice ui so let's just edit this file so let's just edit this file i'm just gonna

[16:09] don't load up straight away uh sometimes i don't you can click the refresh button and that will find your your files it's the same thing as typing git status on the command line um but it just gives you a nicer ui and

[16:21] it's much easier to add and remove files that you need to um another cool feature is if you use the particular things maybe you want to publish a new branch

[16:35] or add a new remote all of the commands that you would normally use in git are all here via the ui so it's much safer to use these and it is to you online and get it wrong

[16:48] now one extension that i really like which works with git is called git lens so we search for kit lens in extensions kit now what this does it gives you a lot of

[17:01] really great functionality directly inside your code base if we go back to our file we can see here on the current line you're on it will tell you who edited that file when it was edited and the

[17:14] and if you hover over that it will give you further details um so you can even you further details um so you can even go to git hub and see the the commit there i hope you like this video on vs code

[17:27] tips and tricks this is only my second video on youtube so please hit like and subscribe to help this channel out thank you

More from Alex Hyett

View all

⚡ Saved you 0h 17m reading this? Transcribe any YouTube video for free — no signup needed.