12 Useful VS Code Keyboard Shortcuts For Mac

Vivek Sanghvi
3 min readFeb 15, 2021

--

Photo by Christopher Gower on Unsplash

As I wrap up my time here at Flatiron, I can truly say it has been an intense experience. Previously coming from a background with little to no coding knowledge, I thought I would make this blog post to help other beginners maneuver visual studio code with more ease. So lets get started:

  1. Being able to search through all files for any matching text. While this may not seem useful when you’re first starting out, keep this tool in your back pocket. Before you know it, you'll be writing hundreds of lines of code and this shortcut will save you from wasting any unnecessary time.
Control + Shift + F

2. Being able to comment out code.

Cmd + /

3. Delete the entire line the cursor is on

Shift + Cmd + K

4. Move the entire line the cursor is on

Option + Down Arrow (to move line down)
Option + Up Arrow (to move line up)

5. Changing multiple of the same word in a file. So if you had the word “Doctor” and wanted to change every instance of the word doctor in that file, you can select all of the words to change at once.

Cmd + D

6. Create a duplicate of a certain line of code. Obviously you can just copy and paste. However you can also…

Shift + Option + Up/Down Arrow Key

7. To zoom in or out of your code

Cmd +/-

8. How to get rid of your sidebar in Vscode

Cmd + B

9. Re-open an accidentally closed Vscode tab

Control + Shift + t

10. Split the editor in Vscode(so you can have side by side tabs open for different files)

Cmd + \

11. Go to the very top or bottom of the file

Cmd + Up/Down Arrow

12. From where your cursor is, you can select the whole file above or below.

Shift + Cmd + Up/Down Arrow

This bonus shortcut I will leave you with will probably be your favorite. No one likes messy code. It makes it difficult for other people to read, and even worse you’ll probably end up confusing yourself as your application starts to build complexity. However for this shortcut you have to download the shortcut “Prettier” from visual studio code extensions. Once doing so you will have the ability to use the shortcut below. In short, this will automatically format your file for you with indentations.

Shift + Option + F

If you’re still new to software engineering and the idea of building out an application from scratch seems daunting, rest assured I felt the same exact way only 7 months ago when I first delved into this. All I can say is keep practicing and before you know it you’ll pick up on things quickly.

You can check out some of my projects on Github that I built out at Flatiron as well as other side projects to see my own coding journey. I’ve gone from building only simple CLI applications to having projects with real auth, and a fully functioning front and back end. Although I am proud of where I have gotten thus far, I know I still have so much to learn.

https://github.com/wickedvic

--

--