15 Useful Visual Studio Code Keyboard Shortcuts to Increase Productivity

Do you want to be highly productive? Get familiar and memorize these VS Code keyboard shortcuts for Linux, Windows, and macOS.
Warp Terminal

There is no doubt that Microsoft’s VS Code is one of the best open source code editor out there. Unlike the legendary Vim, VS Code doesn’t need you to be a keyboard ninja and has tons of features that developers swear by.

But this doesn’t mean you cannot, or you should not use keyboard shortcuts in Visual Studio Code.

Do you hate breaking your coding flow and move your hand to a mouse for performing an action like toggling terminal in your Visual Studio Code (VS Code) editor? If yes, then you should immediately get yourself familiar and memorize these useful keyboard shortcuts for VS Code.

It will not just help you to get rid of a mouse, but also make you highly productive and efficient.

So, let’s get to know how you can code fast by quickly navigating through the code editor using keyboard shortcuts.

Useful VS Code Keyboard Shortcuts

These keyboard shortcuts are what I find most useful when working in VS Code. You may explore more of them based on your needs.

I have also mentioned keyboard shortcuts for macOS users.

1. Show All Commands

Windows/Linux macOS
CTRL + SHIFT + P or F1 SHIFT + ⌘ + P or F1

Starting with the most helpful shortcut, it opens the Command Palette that provides access to all the functionality of VS Code.

VS Code Command Palette visibke when the appropriate keyboard shortcut is pressed
Command Palatte

It is a very important VS Code Shortcut because even if you forget or don’t want to remember any shortcut except this one, you can still perform various operations using Command Palette like create a new file, open settings, change theme, and view all keyboard shortcuts as well.

2. Split VS Code Editor Vertically Or Horizontally

Windows/Linux macOS
CTRL + \ ⌘ + \

If you don’t have a multi-monitor setup for high productivity, you can still view codes of multiple files at once by splitting the editor either horizontally or vertically.

Split Mode in VS Code where multiple files are opened in a grid like arrangement
Split Mode

To change focus into editor group, you can either use number or arrow keys.

Windows/Linux macOS
CTRL + 1/2/3 ⌘ + 1/2/3
CTRL + K CTRL + ←/β†’ ⌘ + K ⌘ + ←/β†’

3. Toggle Integrated Terminal

Windows/Linux macOS
CTRL + ` ⌘ + `

Integrated terminal in VS Code is a very convenient feature that lets you execute the task quickly without switching windows. To hide/unhide the terminal in the editor, this keyboard shortcut comes in very handy.

A Integrated terminal opened in VS Code
Integrated Terminal

However, like me, if you find pressing "CTRL+`" difficult to use due to its weird corner location, you can still open Command Palette and execute View: Toggle Terminal command.

Toggle terminal using Command Palette
Toggle terminal using Command Palette

4. Go To File

Windows/Linux macOS
CTRL + P ⌘ + P

As the project grows, looking for a file might become a very difficult task. Hence, I would suggest even you use a mouse, this command can save you a lot of time in searching and navigating to a file in a repository.

Go to a particular file in VS Code using the search and navigation feature
Go to File

5. Go To Line

Windows/Linux macOS
CTRL + G ^ + G

Once you search a file, you may now want to jump to a specific line for adding or editing code. If a file contains thousands of lines of code, scrolling can definitely eat up your time. Hence, CTRL+G or ^+G VS Code Keyboard Shortcut can quickly take you to a line you want.

Jump to a particular line by specifying the required line number
Go to Line

Alternatively, you can also use the fourth shortcut for β€˜Go To File,’ where appending : colon with line number in the input box works as β€˜Go To Line.’

6. Search Complete Project

Windows/Linux macOS

Most probably, you may also want to search for a text, variable, or function in your whole project. In such a case, this command is very convenient that shows search input in the sidebar.

Search project from the
Search text, variable or function inside your whole project

You can also add filters to your search using ALT+C to match case, ALT+W to match the whole word, and ALT+R to use regular expression.

7. Zen Mode

Windows/Linux macOS
CTRL + K Z ⌘ + K Z

Want to work in a distraction-free environment to stay more focused? Zen mode is a feature in a VS Code that hides all UI (Status Bar, Activity Bar, Panel, and Sidebar) and displays only the editor on a full screen.

Zen Mode or the distraction free mode in VS Code
Zen Mode

To enable Zen Mode, you can either use the above shortcut or open Command Palette and execute β€œView: Toggle Zen Mode.” To exit Zen mode, you need to press Esc button twice.

8. Add Selection To Next Find Match

Windows/Linux macOS
CTRL + D ⌘ + D

This command enables you to select the next occurrences of a selected text for editing. It comes very handy if the next match is located far away from the first match.

Select the next occurrences of a selected text for editing
Next Find Match

9. Toggle Line Comment

Windows/Linux macOS
CTRL + / ⌘ + /

The struggle to reach the start of a line and then add a double forward slash to the comment line can be replaced with this quick keyboard shortcut.

Quickly comment out lines using the keyboard shortcut
Comment Out Code

Even if you want to comment out multiple lines, you can select all lines using SHIFT+UP/Down and then press CTRL+/.

10. Jump To The Beginning Or End Of File

Windows/Linux macOS
CTRL + HOME/END ⌘ + ↑/↓

If you get lost in the middle of your codes, the command can help to quickly reach either start or end of the file.

11. Code Folding Or Unfolding

Windows/Linux macOS
CTRL + SHIFT + [ or ] βŒ₯ + ⌘ + [ or ]

It is one of the most useful shortcuts that can help you collapse/uncollapse a region of code. In this way, you can hide unnecessary code and view only the required section of code at a time to focus more and code fast.

Fold or unfold blocks of code by clicking on the expand symbol
Collapse a region of code

12. Peek Implementation

Windows/Linux macOS
CTRL + SHIFT + F12 ⌘ + SHIFT + F12

The shortcut is most likely to help you in your code analysis or bug fixing where you want to understand the working of functions and variables.

Peek Implementation for code analysis
Peek Implementation

13. Delete Current Line

Windows/Linux macOS

A single quick command can sum up two tasks of selecting a current line and pressing the delete/backspace button.

14. Find And Replace

Windows/Linux macOS
CTRL + F ⌘ + F
CTRL + H βŒ₯ + ⌘ + F

What could be the best way to replace all occurrences of a text in a file with a new one? If you go for one by one manually by scrolling down the code, no wonder how much time it will take if text occurrence is large.

Find and Replace text in VS Code
Find and Replace

While using Find and Replace do the same task within seconds. You can open it using two shortcuts where one actually opens the input box for finding text and the other for replacing text.

15. VS Code Keyboard Shortcuts

Windows/Linux macOS
CTRL + K CTRL + S ⌘ + K ⌘ + S

At last, if you still struggle with remembering all the above keyboard shortcuts, you still don’t have to worry. This is because you can view all available commands for your editor using the above shortcut.

Available Keyboard Shortcuts listed in VS Code
Keyboard Shortcuts

You can also edit keybinding for the command as per your comfort.

Here is a summary of all the keyboard shortcuts discussed above.

Usage Linux/Windows macOS
Opens Command Palette CTRL + SHIFT + P or F1 SHIFT + ⌘ + P or F1
Split Editor Vertically Or Horizontally CTRL + \ ⌘ + \
Change focus into editor group CTRL + 1/2/3 ⌘ + 1/2/3
CTRL + K CTRL + ←/β†’ ⌘ + K ⌘ + ←/β†’
Toggle Integrated Terminal CTRL + ` ⌘ + `
Searching and navigating to a file in a repository CTRL + P ⌘ + P
Jump to a specific line CTRL + G ^ + G
Search for a text, variable, or function in your whole project CTRL + SHIFT + F ⌘ + SHIFT + F
Zen Mode (distraction-free environment) CTRL + K Z ⌘ + K Z
Select the next occurrences of a selected text CTRL + D ⌘ + D
Toggle Line Comment CTRL + / ⌘ + /
Jump To The Beginning Or End Of File CTRL + HOME/END ⌘ + ↑/↓
Code Folding Or Unfolding CTRL + SHIFT + [ or ] βŒ₯ + ⌘ + [ or ]
Peek Implementation to understand the working of functions and variables. CTRL + SHIFT + F12 ⌘ + SHIFT + F12
Delete Current Line CTRL + SHIFT + K SHIFT + ⌘ + K
Find And Replace CTRL + F ⌘ + F
CTRL + H βŒ₯ + ⌘ + F
VS Code Keyboard Shortcuts CTRL + K CTRL + S ⌘ + K ⌘ + S

Want More on VS Code?

If you want to have complete knowledge of VS Code keyboard shortcuts, you can check out the documentation of Visual Studio Code.

Or, if you want all available shortcuts in a single piece of paper, get the above cheat sheet for Linux, macOS, and Windows. You can have a quick look whenever you forget.

Once you learn keyboard shortcuts on VS Code, see how to make your code neat with VS Code auto intend feature.

How to Automatically Indent Your Code in Visual Studio Code
Format your code correctly. Learn how to automatically indent code in Visual Studio Code.

I think you already know to connect VS Code with GitHub?

How to Connect GitHub to VS Code [Step by Step]
Take your coding experience to the next level of ease by integrating GitHub into VS Code.

If the built-in telemetry is holding you back from using VS Code, try VSCodium.

VSCodium: 100% Open Source Version of Microsoft VS Code
Brief: VSCodium is a clone of Microsoft’s popular Visual Studio Code editor. It’s identical to VS Code with the single biggest difference that unlike VS Code, VSCodium doesn’t track your usage data. Microsoft’s Visual Studio Code is an excellent editor not only for web developers but

Let me know your favorite shortcut in the comment section.

Author of this community submission, Sarvottam Kumar, is a software engineer by profession with interest and experience in Blockchain, Angular, React and Flutter. He loves to explore the nuts and bolts of Linux and share his findings with the world.
About the author


Written by a community member, a reader who is not part of the It's FOSS writing team. The views and opinions expressed are those of the authors and do not necessarily reflect that of It's FOSS.

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.