This is the first entry in an on-going series on keyboard shortcuts in Visual Studio Code.
One of the most efficient ways to increase productivity in a text editor is using keyboard shortcuts. They allow you to quickly access features that are often nestled under multiple menus in less time, and also without having to remove a hand from your keyboard to manipulate the mouse. Today I am going to discuss some shortcuts for Microsoft Visual Studio Code that I find to be particularly helpful. For some readers this may be the first time they are being exposed to not only the keyboard shortcut, but to the feature itself. This list is not comprehensive of all the keyboard shortcuts available, but hopefully it helps improve your productivity in VSCode.
Replace Multiple Occurrences in File Ctrl + F2
This shortcut allows you to replace all occurances of a selection at once. First, select the text you wish to replace, then hit the keyboard shortcut, and finally type what you wish to replace the selected text with. This is very useful for quickly changing all instances of a variable or function name.
Note: This is not case sensitive.
Toggle Between Open Editor Tabs Ctrl + Tab
This shortcut allows you to open a list of the currently open editor tabs, cycle through them for selection, and ultimately switch to the desired tab. Hitting the keyboard shortcut once will cycle to the last editor tab you were previously on. Hitting it and continuing to hold Ctrl will open the list with the previous tab selected by default, and tapping Tab (while still holding Ctrl) will allow you to cycle through the list of all open tabs, with releasing bringing you to the editor tab that you have selected. Hitting Ctrl + Shift + Tab while the list of open editor tabs is available will cycle you through the list in the reverse direction.
Reopen the Most Recently Closed Editor Ctrl + Shift + T
This shortcut allows you to quickly reopen the last editor tab that you closed. Hitting the shortcut again will then open the 2nd most recently closed editor tab, and so on and so forth.
Note: Using this shortcut multiple times in succession will open, and keep open, all of the recently closed editor tabs, not result in opening the Nth most recently closed tab and only said tab.
Search Text in All Files Ctrl + Shift + F
This shortcut allows you to search for text in all files in the currently open folder (and all subfolders as well). This will then display the results in the left-hand navigation bar, and allow you to click on them to bring you directly to occurance of the text in the given file. This is useful for quickly finding all occurrences of a variable reference/declaration or function call/definition.
Be sure to check back next week for even more Visual Studio Code shortcuts and productivity tips.