10 Visual Studio Code editing shortcuts
Tags: codenewbie, programming, productivity, webdev
Published: 2022-01-17 13:03:38

Visual Studio Code is a powerful tool that developers like us use on a daily basis for hours. It also is a favorite for a few of us as well. As we spend most of the time typing code, there are a few keyboard shortcuts that help in writing code faster. 
In this article, I will be sharing 10 keyboard shortcuts that I use in Visual Studio Code to code faster and get by without using the mouse.

**1. Cut, Copy and Paste**

There are a ton of times when we use Cut, Copy and Paste while coding. 

- Cut : Command (or Cmd) ⌘ + X
- Copy : Command (or Cmd) ⌘ + C
- Paste : Command (or Cmd) ⌘ + V

![Cut, copy, paste](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5qwmxs7jnznee1hrnn2.gif)

**2. Cursor to Start/End of line**

Use this command when you want to move the cursor to the start/end of the line

- Cursor to start of the line: Command (or Cmd) ⌘ + ←
- Cursor to end of the line: Command (or Cmd) ⌘ + →

![Cursor to start/end](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvjbtoufonr66kv2erzw.gif)

**3. Move line**

This command is used to move the whole line up or down.

- Move line up : Option (or Alt) ⌥ + ↑ 
- Move line down : Option (or Alt) ⌥ + ↓


![Move line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fvgt714p9g2tyw8xlyq.gif)

**4. Add line comment**

I have used this shortcut a lot of times. With the press of just two keys, I can cut down so much work 😁

- Add line comment : Command (or Cmd) ⌘ + /


![Add line comment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eg0elgaac3x9hnjni2hm.gif)

**5. Select a line**

This command is used to select the complete line. After the line is selected, we can use other shortcuts like Copy / Cut.

- Select a line: Command (or Cmd) ⌘ + L


![Select line](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jnycapju3dsqwet0vr8.gif)

**6. Copy line up/down**

Use this shortcut to copy the whole like and paste it up/down

- Copy line up: Shift ⇧ + Option (or Alt) ⌥ + ↑ 
- Copy line down : Shift ⇧ + Option (or Alt) ⌥ + ↓


![Copy line up/down](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rm4sm9z6s5g0ul8tzmil.gif)

**7. Move word by word**

At times to reach a point in between a word, we find ourselves using to move to navigate to that point and placing our cursor. We can avoid this by using a shortcut that moves the cursor word by word.

- Move the cursor to right:  Option (or Alt) ⌥ + →
- Move the cursor to left:  Option (or Alt) ⌥ + ←


![Move word by word](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8d1ie52z59vz22ogkymo.gif)

**8. Select a word**

This command is used to select a word. Further, this command can be combined with Cut/Delete or any other commands.

- Select a word: Command (or Cmd) ⌘ + D

![Select word](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rey3eijdjq13q8jfdky0.gif)

**9. Multiline cursor**

This is my favorite shortcut!! I was so glad when I figured out this shortcut existed, it reduced my time to edit code considerably. Using this shortcut you can place the cursor simultaneously at different places in the editor.
Here is how you use it - Press the Option key and with the mouse, click at various places where you want the cursor to be present.

- Multiline cursor:  Option (or Alt) ⌥  + click


![Multiline cursor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtp6c1tfpj1xjg44cnj2.gif)

**10. Insert cursor above / below**

This is similar to the multiline cursor shortcut. Here we do not use the mouse to click, but we use the arrow keys. Although, this is not as flexible as the click because the cursor moves up/down in a line.

- Insert cursor above : Option (or Alt) ⌥  + Command (or Cmd) ⌘ + ↑ 
- Insert cursor below : Option (or Alt) ⌥  + Command (or Cmd) ⌘ + ↓

![Insert cursor above or below](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2r352m9nbwm87hd5nlzf.gif)

Those are the shortcuts I usually use while I type away on my Visual Studio code editor. When starting to use shortcuts, you might feel confused or it might take a little time to get a hang of it. But once you practice and are used to using shortcuts, you will observe that editing code now takes much less time!! 😇

Tip : Incase you forget the shortcut, open the Command Palette and type in the operation you want to perform (eg : Copy, move line). Visual Studio Code shows the shortcut you can use on the righthand side in the dropdown.

Let me know the shortcuts you use in the comments below!! 

Also, find me on  **[Twitter](https://twitter.com/s_omeal)**  !!