You may be unaware of seven Visual Studio Code (VS Code) secrets. When using VS Code, these tips may make you feel happy and powerful. Before you begin, you should understand three fundamental VS Code concepts.

Command Palette

P (Command+Shift+P) is the most important key combination to remember. On Windows, press Ctrl+Shift+P. You can access all of VS Code’s functionality from the Command Palette, including keyboard shortcuts for the most common operations.

Keyboard Shortcuts Editor

Go to the Code > Preferences > Keyboard Shortcuts menu and select Keyboard Shortcuts Editor. (On Windows, go to File > Preferences > Keyboard Shortcuts.)

Or open Command Palette and input “Open Keyboard Shortcuts”.

Using the Keyboard Shortcuts editor, Visual Studio Code provides a rich and simple keyboard shortcuts editing experience. It lists all available commands, both with and without keybindings, and allows you to easily change, remove, or reset their keybindings by using the available actions.

1. MiniMap

A Minimap provides a high-level overview of your source code, which is useful for quick navigation and code comprehension. The Minimap will render every character by default. But we don’t read the code through the Minimap; instead, we use it to get a glimpse of the program’s structure. Then, in the Command Palette, search for “Open Settings,” enter the Settings Editor, type “editor.minimap.renderCharacters” or “minimap render Character,” and close the render setting to render all characters as color blocks.

2. Source Code Navigation

When reading code, we frequently need to jump from the source code to its definition. You must return to the source code after reading the definition. We must sometimes move forward.

Here we can use the following shortcut keys to complete the source code navigation.

  • Go to Definition: F12
  • Go back: Control +-
  • Go Forward: Control + Shift + –

3. Open the new editor window to the side.

When we want to use “Command + Option + Click,” we open the definition to the side.

4. Create folders and the file at the same time

In one step, you can create a folder and a new file in this folder.

  • Click New File in File Explorer
  • Input “folder/folder/file

5. Breadcrumbs

Breadcrumbs is a navigation bar above the editor’s content. It displays your current location and allows you to navigate quickly between folders, files, and symbols.

This feature is disabled by default. To enable this feature, go to “Open Settings,” search for “breadcrumbs.enabled,” and enable it.

6. Set the default language for new files

You can map all new files to a default language by using the files.defaultLanguage setting. When a new blank file is opened, the editor is set to that language mode.

7. Folding base on Language.

Using the folding icons on the gutter between line numbers and line start, you can fold regions of source code. Each language’s makers can also define regions.

region declares the start of a foldable code block, while #endregion declares the end of this foldable code block. Please see the VS Code official documents for makers in other languages.