Visual Studio Code shortcuts

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.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store