Member-only story

VSCode Keyboard Shortcuts

Ghost Together
7 min readApr 19, 2021

--

Animation was created for each shortcut so it’s easier to understand without doing much reading. Commonplace shortcuts like Ctrl + C are same in most software and will not be mentioned.

1. Shrink or Expand VSCode Selection

Wait, what, we could do this?

I’ll kick this article off with an example of my most favorite keyboard shortcut in VSCode. This shortcut allows you to either expand or shrink selection around natural block scope checkpoints (see animation above.)

On Windows, hold Shift + Alt and use keyboard left and right arrows. On Mac it’s shift + control and the arrows. Left arrow shrinks selection, right arrow expands it.

This shortcut will stop at key points in your function block scopes. It will also stop inside your CSS style definition code and be mindful of opening and closing HTML tags. It helps you to intuitively do what you would have done using the mouse, which saves a lot of time if you develop a habit for using it.

2. Move VSCode Selection One Line Up or Down

Make selection. Hold Alt and press up or down arrows.

Select a word, phrase or a function. While holding Alt use arrow keys up or down to move the selection up or down in your source code.

3. Copy Current VSCode Line Above or Below Selection

You can make a copy of the current line to make another above or below it. This might save some time if you were to do same thing using classic copy and paste shortcuts Ctrl + C and Ctrl + V

Press Shift and Alt and use up and down arrow keys to copy the line either above or below. Continue holding Shift and Alt and using arrows to make as many copies as you need.

--

--

Ghost Together
Ghost Together

Written by Ghost Together

Ghost Together @ https://semicolon.dev is an alternative to Twitter. Sign up to meet other makers of things.

Responses (1)

Write a response