DEV Community


Faster code editing in Visual Studio Code

codevault profile image Sergiu Mureşan ・2 min read

Here are some features that you often forget when you are trying to make a quick change and taking longer to do so. Code editing features are the ones that will help you the most because, well, most of the time you are writing code. Let's get started:

1) Copy/cut whole line

CTRL + C and CTRL + X

Okay okay, I know you probably know about these shortcuts since you were 5 but there is a spin to it in VSCode (and some other IDEs). Without selecting anything, if you use CTRL + C or CTRL + X it will copy and cut, respectively the whole current line.

This saves you a total of 3 keystrokes (HOME, SHIFT + END and lastly CTRL + C or CTRL + X). This blends in well with code editing since you usually work at the level of lines in a source file.

Example video:

2) Move/duplicate line above/below

ALT + / and SHIFT + ALT + /

This is self explanatory. Moving/duplicating a line will be faster than copy/cut
and pasting the whole line.

Example video:

3) Toggle comment on line (CTRL + /)

This really is much faster than commenting lines manually, especially when you have many lines to comment since it automatically comments all lines that are in a selection (whether or not you have the whole line selected).

There are shortcuts for commenting/uncommenting lines (CTRL + K with CTRL + C and CTRL + K with CTRL + U) but, aside from their cumbersome default shortcuts that can be changed I rarely find myself using them. Have you found a use case for this?

Example video:

4) Indenting lines (CTRL + [/])

I have the bad habit of hitting HOME and then TAB or SHIFT + TAB to indent/un-indent a line. This feature saves you the hassle of going to the start of the line and has a very intuitive default shortcut.

Note here: TAB and SHIFT + TAB works the same way if you have more than one line selected

Example video:


giancarlopro image

Thanks to giancarlopro for suggesting a post about these features!

  • Did you know about the copy/cut whole line shortcut?
  • What other features would you like to see next?

Discussion (3)

Editor guide
ondrejs profile image

I don't know; to me it seems that all these Electron-based editors are so slow compared to good ol' Vim...but it could work for you.

codevault profile image
Sergiu Mureşan Author

I don't think Vim works well on Windows, but I will definitely give it a try if my environment supports it.

ondrejs profile image

To be fair I don't know either - I have only experience with BSD/Linux/Mac development ecosystems.