these six shortcuts will make you life easier while coding :-
- SHOW SHORTCUTS
2. SWITCH WORKSPACE
3. TOGGLE WORDWRAP
4. SWITCH TO NEXT WARNING
5. CURRENT LINE SELECTION
6. SELECT ALL OCCURENCES OF PRESENT WORD.
OTHER USEFUL SHORTCUTS INCLUDES :-
- File Explorer
- Switching workspaces
- Opening the terminal
- Go to file
- Go to line
- Go to symbol
- The command palette
- Split Editor
- Toggle editor group layout
- Working with tabs
- Select word
- Folding and unfolding
- Move line upwards or downwards.
- Split lines
- Pageup / Pagedown
- Jump to word
- Expand Region
Opening and closing the sidebar
To close or open the sidebar, you can use
To open the file explorer, you can use
To open the VS Code marketplace, you can use
VS Code automatically keeps track of open cases. Each folder is a workspace. To switch between workspaces, use
r, then select the workspace you want.
Opening the terminal
VS Code has a built-in terminal that navigates to the project folder. To open the terminal,, use
Go to file
To go to a file, you use
p, then type the name of the file you’re looking for. This should help you locate files quickly.
Go to line
To go to a line in the file, you use
g, then type a line number. Alternatively, you can also open the go to file menu with
p first, then type
:, then type your line number.
Go to symbol
To jump to a symbol in VS Code, you use
r, then look for the symbol you want.
To jump to a symbol in your project workspace, you use
The command palette
The command palette lets you execute tasks in VS code. To bring up the command palette, you use
You can type any task you want to complete and VS Code will search for the task for you. If a keyboard shortcut exists, VS Code will show you the shortcut too.
When I code, I usually split the screen into two. You can bring up to three different editor views in VS Code.
To split the editor, you can use the
split editor command. The original keyboard shortcut for split editor is
123. I switched it to
To switch keyboard shortcuts, you can open up the keyboard shortcut editor by opening the command palette, type the keyboard shortcut, then click the pencil icon to the left of the command and enter your new command.
Toggle editor group layout
You can also toggle between horizontal or vertical split layouts in VS Code. To do so, you use the
toggle editor group command.
The original keyboard shortcut is
0. I switched it to
Working with tabs
You can open a new tab by hitting
To switch between tabs, you use
command + the tab number. 1 works for the leftmost tab; 2 for the second tab, and so on.
If you want to switch between tabs in different editors, use
ctrl + the editor number. 1 works for the leftmost editor; 2 works for the second editor, and so on.
To close a tab, use
To select a word, use
d. If you hit
d more than once, you’ll add another occurrence of the same keyword to your selection.
To select all instances of a keyword in the same file, use
g. You can also use
Folding and unfolding
To fold code, use
[. This command lets you hide code that you might not need.
To unfold code, use
Move line upwards or downwards.
To move a line upwards or downwards, use
opt + the
down arrow key.
To split a selection into multiple lines, first select multiple lines, then use
Pageup / Pagedown
If you want to move up or down a document quickly, like through the good old
pagedown shortcut in Windows, you can use
Jump to word
To jump to a word in VS Code, you need to install the Jumpy extension.
Once you’ve installed Jumpy, you can activate Jumpy’s “word mode” through the command line to enter the word jump mode.
In this mode, you can type the two letter characters that’s shown all over the editor to jump to the right word.
To exit jumpy’s word mode, you can type a non a-z character like space or enter.
I set the Jumpy’s word mode keyboard shortcut to
j since J stands for jump.
The Expand region shortcut can only be used if you have installed the Expand Region extension. It should have been in the last video, but I completely forgot about it.
Expand region lets you select a word, expand the selection upwards to the containing brackets (or tags), then another level of brackets, and so on.
To expand upwards, I set the keyboard shortcut to
To undo the expansion, I set the keyboard shortcut to