Anything that makes life easier is worth learning. Visual Studio code is one of the most popular code editors out there, due to its flexibility and large range of features. There are several Vscode shortcuts that allows you to quickly perform a task. In this article, we will look at 10 of my favorites and what they do.
- Ctrl + ! (for windows), cmd + ! (for mac) : This allows you to create the html boilerplate just as shown below.
Ctrl F2 or cmd F2(for mac): This allows you to edit a group of text or word in all the places it occurs in the file document.
Ctrl KZ or cmd KZ (for mac): This is referred to as Zen mode. Zen mode allows you to focus solely on your code, hiding all buttons and toolbars from the view.
- Ctrl + Shift + P(windows) or cmd + Shift + P(mac) : This shortcut key is referred to as command palette. It allows you to open up a list of suggested shortcuts, functionalities and configuration in vscode. This would help you find a command you are looking for, without having to memorize.
- Alt + Up/Down Arrow or opt + Up/Down Arrow( for mac) : This allows you to move a line of code up or down. Use up arrow to move up, and down arrow to go down. The last link below was moved down.
Ctrl + shift + k or cmd + shift + k (for mac): This key allows you to delete a line of code without having to select all text on the line.
Shift + alt + down/up or Shift + opt + down/up (for mac) : This is helpful when you want to add more than one line of the same or very similar code. It copies the code in the current line and pastes it down or up continuously as you desire, just as shown below.
- Ctrl g: This navigates you to a specific line. On typing this, a command palette pops up & you just have to type in the line number. This is very helpful instead of scrolling through lines especially if your file is large.
- Ctrl = or cmd = (for mac) : allows you to zoom in, while Ctrl - allows you to zoom out
- Ctrl T or Cmd T (for mac): this allows you to find a class, function or variable in a file document.
Thank you for reading this. I hope you start using shortcut keys to make coding faster! Love as always, Benazir.