VSCheat

A useful collection and cheat-sheet for VSCode

Keyboard Shortcuts

Save All Open Files

Saves all currently open files

ctrl+
k
then
s

Save Without Formatting

Saves your current file, without running your formatter

ctrl+
k
then
ctrl+
shift+
s

Close All Open Files

Closes all currently open files

ctrl+
k
then
w

Open file in new window

Opens your current file in a new VSCode window

ctrl+
k
then
o

Toggle Selected Line Comment

Toggles comment on the selected line or lines

ctrl+
/

Select current line

Selects the current line that your cursor is on

ctrl+
l

Fold All

Folds all code blocks in current file

ctrl+
k
then
ctrl+
0

UnFold All

UnFolds all code blocks in current file

ctrl+
k
then
ctrl+
j

Go to File

Opens UI to search for file in workspace

ctrl+
e

Indent Line

Indents the current line

ctrl+
]

Un-Indent Line

Un-Indents the current line

ctrl+
[

Go to next error

Goes to the next error or warning in the current file

f8

Insert Line above

Inserts a blank line above the current line, and moves your cursor to it

ctrl+
shift+
enter

Go to symbol

Opens UI to search for symbol in current file, and moves your cursor to it

ctrl+
shift+
o

Cursor Undo

Will undo the last cursor movement

ctrl+
u

Open Markdown Preview

If the current file is markdown, opens a preview of it to the side

ctrl+
k
then
v

Copy Path

Copies the full path of the current file to your clipboard

ctrl+
k
then
p

Set language

Allows you to set the editor language for the current file

ctrl+
k
then
m

Remove trailing whitespace

Removes all trailing whitespace from the current file

ctrl+
k
then
ctrl+
x

Change all occurrences

Whatever word you have selected, all occurrences will be selected allowing you to replace them

ctrl+
f2

Hide/Show Sidebar

Will hide or show the sidebar

ctrl+
b

Select Next Instance

If you have a word selected, this will find and select the next instances of it in the same file.

ctrl+
d

Open "Breadcrumbs"

Opens breadcrumbs UI, allowing you to use arrow keys to navigate paths, and code blocks.

ctrl+
shift+
.

Open snippet search

Opens a UI allowing you to search your available snippets.

ctrl+
alt+
r

Zen Mode

Toggles VSCode in Zen Mode, which will hide most of the UI, and only show the editor.

ctrl+
k
then
z

Open Explorer

Opens and selects the explorer, allowing you to navigate and open files. (works while in Zen Mode)

ctrl+
shift+
e

Open Source Control

Opens and selects the source control, allowing you to manage your repo. (works while in Zen Mode)

ctrl+
shift+
g

Find in All Files

Opens the find in files UI, allowing you to search for a string or regex in all files.

ctrl+
shift+
f

Find in Current File

Opens the find in file UI, allowing you to search for a string or regex in the current file.

ctrl+
f

Toggle Terminal

Toggles the terminal and debug console. If already open it will focus it. (works while in Zen Mode)

ctrl+
`

Select next console

Selects the next console. Only works when console is focused

ctrl+
PAGE DOWN

Select previous console

Selects the previous console. Only works when console is focused

ctrl+
PAGE UP

Toggle Open File Selector

Opens the open file selector, allowing you to tab to an already open file.

ctrl+
tab

Move Current Line Up

Moves the current line up, if it is not the first line in the file.

alt+
up

Move Current Line Down

Moves the current line down, if it is not the last line in the file.

alt+
down

Duplicate Current Line Up

Duplicates the current line up.

alt+
shift+
up

Duplicate Current Line Down

Duplicates the current line down.

alt+
shift+
down