If you need to quickly open a file in your workspace, the best way to do this is by using the Quick File Search feature. To open this feature, press Command ⌘ + P. This will bring up a search bar, where you can start typing the name of the file you want to open. As you type, Visual Studio Code will provide suggestions based on your workspace, and you can simply select the file you want to open from the list.
When the Quick File Search dialog pops up, you can start typing to narrow down the results. Use the Up and Down arrows to select the file you wish to open and hit Enter
When you have multiple tabs open in Visual Studio Code, it can be a bit challenging to navigate between them. However, there are a few keyboard shortcuts that can make this task much easier. To navigate between recently used tabs, hold down Ctrl + Shift + Tab, and keep pressing the Tab key until you find the right tab, at which point you can release the Tab key and subsequently the Ctrl + Shift keys. Additionally, you can jump directly to a specific tab by pressing Ctrl + 1 to Ctrl + 9, depending on the tab number - based on the order in your tab list - you want to open.
Switching between tabs with Ctrl + Shift ⇧ + Tab
One of the great things about Visual Studio Code is that it allows you to customise your own keyboard shortcuts. If there's a specific command you use frequently, you can assign a keyboard shortcut to it to make it even easier to access. To open the Keyboard Shortcuts editor, press Command ⌘ + K + S. From here, you can search for commands and assign keyboard shortcuts to them as desired.
Change and add new shortcuts for commands in the Keyboard Shortcuts settings menu
Visual Studio Code has an integrated terminal that allows you to run commands directly from within the text editor. To open the terminal, press Ctrl + Shift ⇧ + `. This can be particularly useful if you need to run a command that you don't want to run in your regular terminal window.
VS Code has it's own built in terminal
When you're working with code, it's often necessary to select text. There are a few keyboard shortcuts that can make this task much easier. For example, to select text word by word, press Command ⌘ + Shift ⇧ + Left/Right Arrow. Additionally, you can move the current line up or down by pressing Alt + Up/Down Arrow.
You can conveniently select around blocks of code with the Command ⌘ + Shift ⇧ + L/R arrow key combination
Use Alt and the Up / Down arrow keys to move a selection up or down your code
If you need to select multiple occurrences of the same text, Visual Studio Code has a multi-selection feature that can make this task much easier. To select the next occurrence of the selected text, press Command ⌘ + D. This will allow you to select multiple instances of the same text, which can save you a lot of time when making changes to your code.
Another essential set of keyboard shortcuts for Visual Studio Code is Undo and Redo. To undo the last action, press Command ⌘ + Z. To redo the last undone action, press Command ⌘ + Shift + Z. These shortcuts can be a lifesaver if you accidentally make a mistake in your code and need to revert it. Bonus: These commands also work in a number of other applications for the same purpose.
When you're working on a project, you might want to temporarily comment out some code to see how it affects the rest of the project. Visual Studio Code makes this process simple with the commenting out shortcut. To comment out the selected line(s) of code, press Command ⌘ + /.
You can comment out one or many lines in one go with the commenting out shortcut
Sometimes you may need to insert a new line above the current line in Visual Studio Code. To do this, simply press Ctrl + Shift + Enter. This can be useful if you need to add a new line of code above the current line without having to navigate to the beginning of the line.
In conclusion, these are just a few of the most useful keyboard shortcuts for Visual Studio Code. By utilising these shortcuts, you can save a lot of time and effort in your coding activities, making you more productive and efficient. There are many more shortcuts available in Visual Studio Code, and remember: you can find a complete list of commands and their shortcuts in the Command Palette (Command ⌘ + Shift + P). Happy coding!
Why don't you check out our Web Development Mastery course? Go from complete beginner to industry-ready Junior Developer in as little as 28 weeks.
Study around your life with our self-led course, and cancel at any time. Why don't you have a go? Enjoy a whole month on us...
Start your free trial today! Check it out here.Normal text.