Visual Studio Code shortcuts

@Anil's Notes
4 min readJun 15, 2022

Visual Studio Code (VS Code) is the favorite source code editor for developers. VS Code provides powerful developer tools such as IntelliSense code completion, debugging, plugins, and themes that improve developer efficiency and productivity. You can learn more about VS Code here.

In this blog post, I will share the top VS Code for improving my productivity

Open: Open a folder/file in VS Code from the mac terminal or command line:

code App.vue. #Open a file with VS Code editorcode .  #Open current directory with VS Code editor

Keyboard shortcuts: It generally takes a few extra seconds every few seconds to move back and forth between mouse and keyboard. Keeping your hands on the keyboard will enable you to code faster in a long run. Here I will list down the shortcuts I generally use.

Note: Wherever CTRL/CMD is mentioned please use CMD (Mac) or CTRL (Windows)

Toggle Sidebar: The sidebar occupies a lot of space and generally, we click on it often to view the files. You can simply toggle on/off the sidebar using the below command:

Toggle SidebarCTRL/CMD + B

Toggle VS Code terminal: The VS Code terminal is the area developers install dependencies, build, run commands, start the dev server, etc. This does take a lot of space as well.

Toggle VS Code TerminalCTRL + `
Before & After toggle view (More space)

Open a file: While working on a project, generally, it is difficult to navigate through the tree hierarchy every time you need to open a file. An easier tip is to try the below command and then you can simply search, it also displays your recent files to get to it faster.

I love this shortcut

Open a fileCTRL/CMD + P

Tab through open files

Tab through open filesCTRL + TAB

Split to a new window and move the file: Sometimes you require to work on two windows to easily refer to multiple files and code.

Split to a new window and move the fileCTRL/CMD + \
VS Code superpower — work on multiple windows
Close a fileCTRL/CMD + WSearch and replaceCTRL/CMD + F

Open command palette: I understand the keyboard shortcuts are hard to remember initially, I recommend just remembering this shortcut so that you can run commands that every other shortcut can do

Open command paletteCTRL/CMD + SHIFT + P
Open Command Palette, type the command, select, and press enter
Toggle comment (Select multiple lines before issuing the command)CTRL/CMD + /Navigate textHold Alt/Opt + use left/up/down/right arrows to move word by wordHold CTRL/CMD + use left/right arrows to move from start to end in a row, and use up/down arrows to move to top and bottom in a pageCopy (Tip: to copy a line you don't need to select it, just stay on the line and copy)CTRL/CMD + CCutCTRL/CMD + XPasteCTRL/CMD + VSelect wordCTRL/CMD + D

Zen mode: Zen is a Japanese word for meditation, peace, and calmness. When you need to focus on a difficult task without distractions, Zen is your friend.

Zen mode (Wait for a second after you press key K)CTRL/CMD + K Z
Note: Press escape to exit zen mode.
Zen mode

If you don’t remember any of these shortcuts then simply remember the below shortcut and you can get to any of the above and additional shortcuts.

Open command paletteCTRL/CMD + SHIFT + P

Using the above keyboard shortcuts will enable you to code faster.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

@Anil's Notes
@Anil's Notes

Written by @Anil's Notes

Thoughts I add here are my personal notes and learnings only

No responses yet

Write a response