To faster coding, you should start using shortcuts available in a code editor. If you want to use shortcuts productively, you need to build new habits. Now I would like to list the most popular shortcuts for Powershell extension in Visual Studio Code.
First what you have to do is list shortcuts for your code editor what you would like t use. I’m using Visual Studio Code. This code editor has a lot of useful shortcuts. You don’t need to learn all of them. Start using one by one and build habits. When you start using code editor shortcuts, you will observe that you write and test your code faster.
The first step to productive coding
Firstly, you should search for a list of keyboard shortcuts available in your code editor. For Visual Studio Code shortcuts list is available here.
All right, that’s enough introduction words. Let’s list the most productive Visual Studio Code keyboard shortcuts.
Comment selected lines
The first one, the most productive shortcut for Powershell users helps to mark as a comment one or more lines of code. You don’t have to go to the beginning of the line.
Windows: Ctrl + /
macOS: ⌘ + /
The second one is very similar to the previous one. It helps to mark a few lines of code as a block comment.
Windows: Shift + Alt + A
MacOS: ⇧⌥A (Shift + Alt + A)
The next one helps to write more understandable code. You can add or remove lines indent to your script.
Windows: Ctrl + ] / Ctrl + [
MacOS: ⌘ + ] / ⌘ + [
Split code new
If you want to edit more than one files at the same view, you can split the code view.
Windows: Ctrl + \
MacOS: ⌘ + \
Show Powershell terminal
To show Powershell console in Visual Studio Code, you can use the below shortcut.
Windows: Ctrl + `
MacOS: ⌘ + `
Run selected code
It’s an especially important shortcut for Powershell ISE lovers. With this shortcut, you can run a selected code.
Windows: Ctrl + Shift + P
MacOS: ⌘ + Shift + P
To sum up, the Visual Studio Code has a lot of available shortcuts. I mentioned only a few of them. The whole list for MS Windows you can find here (for macOS here). Remember, if you want to use shortcuts productively, select a few of them, and start building habits.
What is the most valuable shortcut for you?