VS Code - Amateur to Pro 2
Tags: vscode, productivity, programming, beginners
Published: 2023-01-22 11:08:31

VS Code Productivity tips and speed hacks - 2

6. Move around quickly 

Command palette is awesome but it doesn't help you write your code faster, when you see a line of code you want to edit the natural approach is to select and highlight that line. A developer might do this 100s/1000s of times a day.

A faster way to get to where you want to edit is to hit `ctrl + go` followed by the line number you want to edit, from there use the arrow keys to move character by character and start editing. 

![cmd+g](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcvdold911o9vccmxth2.png)

7. Multi-line editing

If you want to edit a word in multiple lines at the same time when the cursor lands on the word you want to edit with the help of the above-mentioned method hit `ctrl + d` or `cmd + d` again and again to select the same word. And now you're a 3x developer editing multiple lines of code at the same time.

In some cases you may want to use the mouse to select multi-line editing in such cases hold the `alt` or `option` key and click on different parts of the code in different lines where you want to edit, the editor will then set cursors in multiple places which will be then useful and easy to use for writing repetitive codes.

![Multi line editing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4tu9mmuokkp2mvdm2fi1.png)

![Multi line editing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l05dzwwz75orxjex7i28.png)


8. Delete or move a line 

If you want to delete a line from VS Code and paste it somewhere else the amateur approach is to highlight and select the line hit `ctrl+x` or `cmd+x` to cut the line and paste it with `ctrl+v` or `cmd+v` where you want to paste it. 

But a better approach to do that is if you already have your cursor on the line you want to cut hit `ctrl+x` or `cmd+x` to cut the line not highlighting it required. Or if you want to paste that line above or below you can simply move the line with `option/alt + up arrow/down arrow`. Or if want to copy the line down by hitting the command available in your VS Code keyboard shortcuts.

9. Custom snippets

In many projects, you may find yourself writing the same boilerplate again and again if you find yourself doing that a faster way to increase your productivity is to add a custom snippet. 

From the command palette run the `configure user snippet` command. You can create global projects to use them across all over your project, now you edit this `JSON` file to add your snippets. 

And now in your file, you can use the `insert snippet command` to insert your snippet. But if you work with a popular framework there are chances someone might have done that already for you. Before you build yours go into the extensions section and check out for your language snippets if available. 

![command palette](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hzg4v8gh7njxxrdmnzo3.png)

![command palette](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mzae7nmid4fwqv04cyew.png)


![Snippet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kczx9rxdp1t56v8da4kw.png)


10. Auto-create directory/file

If you need to create a file in a folder that doesn't exist yet you can create that file by clicking on the create new file button, writing the file name with the nested directory names on top of it by putting a slash in front on them to separate them and VS Code will automatically create those directories.

![Auto create directory/file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkfxxooako4hy9fqrllf.png)

![Auto create directory/file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5e7abg8l9wl5bliz9o6.png)

Let me know in the comments below the productivity hack you use to boost your productivity. 

##### Want to connect?

<p>
  <samp>
    <a href="https://twitter.com/garimaasharma_" target="_blank">twitter</a> ·
    <a target="_blank" href="https://dev.to/garimasharma">blogs</a> ·
    <a target="_blank" href="https://garimasharma.netlify.app">portfolio</a> ·
    <a target="_blank" href="mailto:sharmagarima814@gmail.com">email</a> ·
    <a target="_blank" href="https://www.linkedin.com/in/garima-sharma08/">linkedin</a>
  </samp>
</p>

<a href="https://www.buymeacoffee.com/garimasharma"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=garimasharma&button_colour=FF5F5F&font_colour=ffffff&font_family=Arial&outline_colour=000000&coffee_colour=FFDD00" /></a>