7 Under-Utilized VS Code Shortcuts

A quick no-nonsense guide

Nov 04, 2024

Home

Ordered best-first so it's easier to skim through.

1. Ctrl + D - Select next text match.

An absolute essential. After selecting any text, use this to incrementally select the next matching text. Need to get many cursors at the right points in your code, but it's not convenient to CTRL + F or hold ALT while clicking everywhere? Now it takes 2 seconds.

2. F2 - Rename symbol.

Works on folders and files, but I mostly use it to rename imported variables, since as long as you do this at the variable's definition, all inherited instances will also be renamed.

3. SHIFT + ←/→/↑/↓ - Expand/contract selection.

Selects text as the cursor moves over it. Especially nice to use in tandem with holding CTRL to jump by groups of letters.

4. CTRL + SHIFT + T - Reopens closed tab(s).

You should know this one already since it works on your browser and other apps too; it's like CTRL + Z for your viewports.

5. ALT + ↑/↓ - Move line(s).

Moves any selected lines of code up or down. Very simple.

6. CTRL + . - Quick fix.

Activates the Code Action context menu, which is useful for speeding up module imports, saving to dictionary, or otherwise resolving squiggly underlines.

7. CTRL + P - Go to file...

Search and open files by filename or extension. Also press SHIFT (or type >) to start searching editor commands, such as "Developer: Reload Window."


These should work in editors other than VSCode; if they don't, make a quick google of your editor's shortcuts to find the right binding. VSCode maintains this single-page list.

I've included a few more good ones in case you were curious:

8. SCROLL_CLICK + DRAG: Rectangular highlight.

Hold your scroll button and drag to highlight a visual rectangle of text.

9. CTRL + `: Show integrated terminal.

You'll use this more than you think.


I hope at least one of these sticks with you!