VS Code Shortcuts To Code Like You're Playing a Piano
Tags: vscode, programming, code
Published: 2023-01-13 18:06:02


I’ll be honest, being fast while programming is half the reason I even code anymore (Jk. Unless...). Anyway, I’ve found the thing that made me become a lot quicker was divorcing my hand from the mouse. Think about it, every time you have to move the mouse, you have to do these things:

1. Move your hand from the keyboard to the mouse (ouch, my shoulders)
2. Find where that dagnabbin’ cursor went to
3. Physically move the cursor to where you need and click
4. Move your hand back to the keyboard (again, ouch, my shoulders)

Here are my top shortcuts that will make you feel like you’re playing the piano while you’re coding:

## Multiple Cursors

> Quickly create multiple cursors to change multiple sections of code

What’s the quickest way to increase your code output? Simple! Add more cursors!! Now you can write infinitely more code in the same time! More code = more better!

- Linux: `Ctrl + Shift + Arrow Up / Arrow Down`
- Windows: `Ctrl + Alt + Arrow Up / Arrow Down`
- Mac: `Cmd + Opt + Arrow Up / Arrow Down`

![Multiple Cursors Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6gkvm2ll4v0r7p1g5b7.png)

![Multiple Cursors Shortcut Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0692xyb16maj585egls.gif)

## Select Next
> Select the next occurrence of whatever you have currently selected

You want to change that one string in multiple places, and you knew you should’ve set it as a variable somewhere and reused it, but here we are anyway. Do you use an overkill find and replace or put your hand on the forbidden device known as the mouse? Blasphemy!

- Linux / Windows: `Ctrl + D`
- Mac: `Cmd + D`

![Select Next Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/exjrmuzxos0uu4vzespf.png)


![Select Next Shortcut Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bq995ctscxocy92c5ntf.gif)


![Another Select Next Shortcut Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y6w8550vo0h5xso7v47c.gif)

## Undo Select Next
> Rollback the last select-next by one step

You have discovered the power of `select next`, but perhaps too early. If you see yourself going mad with power and next-selecting things you shouldn’t have, this one is for you!

- Linux / Windows: `Ctrl + U`
- Mac: `Cmd + U`


![Undo Select Next Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hsl97q1e5zkngq245wy.png)


![Undo Select Next Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9d3jc4i9tkc8p9o720xn.gif)


## Scroll the Screen Without Moving The Cursor
> Keep your cursor in place while scrolling up and down in your code

Sometimes you want to hide the crappy code you wrote above so you can focus on a brighter future. “I will refactor it later,” you say. A lie. but you already knew that. So, why face the facts when you can scroll, scroll, scroll your shame away?

- Linux / Windows: `Ctrl + Up Arrow / Down Arrow`
- Mac: `Ctrl + Fn + Up Arrow / Down Arrow`


![Scroll the Screen Without Moving The Cursor Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wwyqwdxls7hosfpaqtg1.png)


![Scroll the Screen Without Moving The Cursor Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqyv8gn51vg6d0mddzok.gif)


## Jump Word
> Move your cursor one word at a time instead of one char at a time

Your days of holding the right or left arrows for what feels like an eternity are over. One click, one word. Elegant.

- Linux / Windows: `Ctrl + Left Arrow / Right Arrow`
- Mac: `Opt + Left Arrow / Right Arrow`

![Jump Word Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkxq97e7g3plry5jaxfb.png)

![Jump Word Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2tuyb8u72pdglq6datw.gif)

## Select Word
> Jump one word and select it at the same time

Maybe that word has done you something wrong. Who knows. Regardless, you can show it who’s boss by selecting it in one go and nuking it to oblivion (or whatever your mastermind has in plan).

- Linux / Windows: `Ctrl + Shift + Left Arrow / Right Arrow`
- Mac: `Opt + Shift + Left Arrow / Right Arrow`

![Select Word Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9s42yupby45he1t0x27l.png)


![Select Word Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkquf59hx2n0v3gr3s97.gif)


## Jump To End or Beginning
> Instantly go to the beginning or end of code on your current line

You wake up in the morning, turn your workstation on, and open your code editor. You find your cursor at the end of a line, but you need it at the beginning. *Sigh,* you say to yourself, “Guess I’ll get some things done while that’s happening.”

You place a rock on your left arrow and go on with your day. You shower, grab a cup of coffee, decide for two hours what music playlist you’re listening to for the day, go through ten meaningless corporate meetings, and then return to your code editor.

You remove the rock off your left arrow, and to your rejoice, you have finally reached the beginning of the line. Save yourself an eternity by using this shortcut.

- Linux / Windows: `End / Home`
- Mac: `Cmd + Left Arrow / Right Arrow`

![Jump to End Or Beginning Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6uwm5o4p4i1w7qcz9mdp.png)


![Jump To End Or Beginning Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgedbbnbozyh0ufrs30q.gif)


## Select Till End or Beginning
> Instantly select all code until the beginning or end of your current line

People throughout history have done much with power they’ve accumulated over their lives. Genghis Khan, Attila the Hun, Spider Man, etc. These people have used their power in various destructive ways. None of it compares to what this shortcut allows you to do. Use it wisely.

- Linux / Windows: `Shift + End / Home`
- Mac: `Cmd + Shift + Left Arrow / Right Arrow`

![Select Till End or Beginning Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bemo2848ttl4i3p3y9kh.png)


![Select Till End or Beginning Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcfu4yj7a01takixr9ze.gif)

## Expand / Shrink Selection
> Expand the scope of your selection to include more / less scope (i.e string, function, etc.)

Only the cool kids use this one.

- Linux / Windows: `Alt + Shift + Left Arrow / Right Arrow`
- Mac: `Ctrl + Shift + Left Arrow / Right Arrow`

![Expand / Shrink Selection Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eovvm12qw5uiuh3w6pyh.png)


![Expand / Shrink Selection Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rqw9hm6e7w81cwwpoexd.gif)


![Expand / Shrink Selection Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tdztro55rs6to4075gms.gif)


## Show / Hide Terminal / Go back to code
> Toggle terminal focus / visibility and move focus back to your code

Sneak a peek at your failing build every once in a while. Yup, still failing. Let’s just close that real quick.

- Linux / Windows: Ctrl + J for terminal, Ctrl + 1 for code
- Mac: Cmd + J for terminal, Cmd + 1 for code

![Show / Hide Terminal / Go back to code Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv8qu5ojlua60s0w6cll.png)


![Show / Hide Terminal / Go back to code Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w81p55qdw7waa10stzld.gif)


## Split Terminal

> Split the terminal into two or more panes visible at the same time

Studies show that people with more terminals on at a given time are better hackers. It’s just a fact. Accept it. Embrace it.

- Linux / Windows: `Ctrl + Shift + 5`
- Mac: `Ctrl + Cmd + Opt + * (star)`

![Split Terminal Shortcut](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bf8eymyhb4pnwn36qw5a.png)


![Split Terminal Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pi7i76w3dztrgfp2ak0.gif)

## Conclusion
I solemnly swear I have not touched my mouse during the making of these demos.

You’ll know you’re starting to become better when you see dust building up on your mouse. Also, don’t forget to buy the loudest mechanical RGB keyboard you can find. That’ll scare away the mouse users!

What’s your favorite / most used shortcut?