DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Amy Chen
Amy Chen

Posted on • Updated on

VS Code Mac Keyboard Shortcuts

Time. Time flies. Time is money. Time is of the essence.
We lose it. We spend it. We kill it. We all have the same 24 hours of it.
We can't make more of it.

Why spend more time doing something if you don't have to?
These are the Visual Studio Code keyboard shortcuts I use most often that saves a little bit of time.
The shortcuts list can also be viewed inside Visual Studio Code:
Code --> Preferences --> Keyboard Shortcuts

- EDITING -

Comment out a line or block of code
⌘ + /

Delete a line of code
⌘ + X

Delete a word in front of cursor
βŒ₯ + DELETE
NOTE: need to apply twice if the word is in front a symbol

Delete all code in front of cursor
⌘ + DELETE

Copy and paste a line of code
βŒ₯ + SHIFT + UP/DOWN

Insert new line below the current line
⌘ + ENTER

Insert new line above the current line
⌘ + SHIFT + ENTER

Move a line or block of code up or down
βŒ₯ + UP/DOWN

- SELECTION -

Select a line of code
⌘ + L

Select a block of code by line
cursor at beginning of line + SHIFT + UP/DOWN

Select all code above or below cursor
⌘ + SHIFT + UP/DOWN

Select next instance of a word
selected word + ⌘ + D
NOTE: not case-sensitive

Select all instances of a word
selected word + ⌘ + SHIFT + L
NOTE: not case-sensitive

Select all instances of a word by case
Turn on "Match Case" ("Aa" icon on upper right corner will turn white):
⌘ + C + βŒ₯
Highlight one instance of the word.
Select all instances of the word: ⌘ + SHIFT + L

- WORKSPACE -

Open terminal
⌘ + J
CTRL + `

Wrap text
βŒ₯ + Z

View sidebar
⌘ + B

Open Find
⌘ + F

File search
⌘ + P

The amount of time saved with these shortcuts can now be used to stare at your computer while figuring out why your code isn't working. Hope these help you to become a more efficient programmer. If you know of any others or the equivalent Windows shortcuts, please share!

Top comments (0)

Create an Account!

πŸ‘€ Just want to lurk?

That's fine, you can still create an account and turn on features like 🌚 dark mode.