VS Code Tips & Tricks
How to open it
Use the command line to open it within the project on which you are working:
code .Managing the windows
Toggle the sidebar (with the file list) open or closed:
command + bToggle the built-in terminal open or closed:
control + `Split the editor window:
command + \File management
Create a new file (mind what location you are creating it in):
command + nOpen file (shows the open file dialog box):
command + oSave file (do this a lot):
command + sClose current tab (or the whole editor if no files are open):
command + wBasic Text Editing
We all know about Cut, Copy, and Paste. We may have been using them from our Edit menus with a mouse but no longer! We are developers now and we live in the command prompt:
Copy:
command + cCut:
command + xPaste:
command + vNormally, we need to highlight text to perform one of those actions but VS Code has some more advanced tweaks. Simply place your cursor on a line and try the following:
Copy an entire line:
command + cCut an entire line:
command + xCommand + v will still paste whatever is on the clipboard.
Move an entire line up or down:
option + up/down arrowCopy an entire line up or down:
shift + option + up/down arrowIndenting/unindenting blocks: (with a block highlighted)
tab/shift + tabCommenting lines or blocks: (with the cursor on a line or a block selected)
command + /Multi-cursor editing
Want to edit multiple lines at once? Add cursors to adjacent lines upward or downward:
command + option + up/down arrowWant to select multiple occurances of the same word? Select it once and then use:
command + dExtensions
Bracket Pair Colorizer - CoenraadS: Colors matching opening and closing brackets with the same color for easy location.
indent-rainbow - oderwat: Makes each indentation level a different color for easy reference.
Material Icon Theme - Phillipp Kief: Gives attractive icons to VS Code.
open in browser - TechER: Adds an "open in browser" context menu item. Handy for launching HTML files.
Rainbow Brackets - 2gua: More bracket colorizing.
Full VS Code Command Reference
This PDF shows all the Mac OS commands for VS Code:
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf
Last updated
Was this helpful?