Really useful VS Code key bindings and format on save
These are the key bindings I use on VS Code to do work more efficiently. Look for the Zen Mode key binding!
These are the key bindings I use on VS Code to do work more efficiently. If you haven't tried it yet, go try Zen Mode on VS Code (look for the key binding below).
Terminal
ctrl + `
- open/close the integrated terminalctrl + shift + `
- open a new integrated terminalctrl + PageUp/PageDown
- switch terminal tabs (or file tabs if the terminal is closed)
Writing Code
ctrl + /
- toggle line commentctrl + (shift) + enter
- insert a new line (up) down the current lineshift + alt + up/down
- copy line(s) up/down (i.e. select multiple lines to copy multiple lines)alt + up/down
- move line(s) up/downctrl + g
- go to linectrl + shift + space
- show parameter hintsctrl + shift + o
- go to symbol (i.e. go to a variable, a function, etc. in a file)F2
- rename symbol (e.g. select a variable and rename other instance of that variable)ctrl + shift + m
- open/close problems tab (e.g. eslint errors)
Files
ctrl + w
- close filectrl + p
- go to filectrl + shift + e
- open file explorer on the sidebar
Appearance
ctrl + k + t
- change themectrl + k z
- toggle Zen mode (i.e. ctrl+k, release, then z, to toggle workspace focus mode)
General
ctrl + shift + p
- open the command palette (e.g. type commands for anything in VS Code)ctrl + b
- open/close sidebarctrl + shift + x
- open extension on the sidebarctrl + z
- undo last actionctrl + s
- save file
Format on Save
Lastly, if you want to automatically format your files, you can add the following to the workspace settings. Open the command palette, ctrl + shift + p
then go to "Workspace Settings (JSON)". This will only work if you have a formatter already installed like Prettier for JavaScript.
{
"editor.formatOnSave": true
}