Ask HN: Favorite VS Code shortcuts, tips and tricks?

16 points by overclk64 ↗ HN
I want to streamline my editing and I'm looking for some interesting keyboard shortcuts, tips and tricks, and features in general.

I quite like how you can do a regex find/replace, for example.

Feel free to share below the ones you find the most helpful, and also to point me towards some resources (I found the subreddit quite useless).

13 comments

[ 3.4 ms ] story [ 36.0 ms ] thread
ctrl p and ctr shift p thats all i know lol
Place a cursor at the end of every selected line:

1. Select the lines you want to do this with.

2. Press `Shift-Opt-i` on macOS and probably something like Shift-Alt-i on Windows/Linux.

Column Select:

1. Place curso where you want.

2. Hold Shift+Option and mouse down.

This and more covered here: https://code.visualstudio.com/docs/editor/codebasics

Emacs key bindings through the "Emacs Friendly Keymap" extension [1]. I wonder if for newcomers it is still a good idea to learn Emacs keybindings. At least for those who did, we can use nearly any IDE with it. Don't forget to make Caps Lock an additional Control though.

As a second tip I cannot recommend Remote Development [2] enough.

And while I'm at it -- on a laptop with a crappy trackpad, multiple cursor support can be infuriatingly annoying. I can't seem to disable this "feature".

[1] https://marketplace.visualstudio.com/items?itemName=lfs.vsco...

[2] https://code.visualstudio.com/docs/remote/remote-overview

Cmd+Shift+L: Select all occurrences

Ctrl+g: Jump to line X

Are two of my favorites that came to mind

My favorite shortcuts preset is called IntelliJ Idea.

Saves ton of time when you’re coding in the flow and don’t have to stumble on unpolished and rough edges every second.

If it was fast as VSCode or Sublime I could get used to it...
This ask unintentionally sets up a vote between Emacs and vim keybindings, and I'm looking forward to seeing which wins.
Don't remember if I have customized the shortcut or not but

- Ctrl + l - copy line down

- alt + up/down arrow - shift line above or below

- multi-cursor functionality

- Distraction-free mode

These in particular are most used and loved by me

Is there a way to show how many lines I’ve selected?
There's an extension for it, or you can add a cursor to the end of each selected line and look at the number of selections in the status bar.
cmd + shift + e to focus the explorer

cmd + b to toggle it open and closed

cmd + [any number] focuses split panes (and opens one if it doesn't exist yet)

control + [any number] to focus different files open in the existing pane