Fundamentals 8 min read

Common VS Code Keyboard Shortcuts for Efficient Coding

This article lists essential VS Code keyboard shortcuts across Windows, macOS, and Linux, covering actions such as joining lines, formatting code, trimming whitespace, folding, duplicating lines, multi‑cursor editing, navigation, and command palette usage, helping developers boost coding efficiency without memorizing every shortcut.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
Common VS Code Keyboard Shortcuts for Efficient Coding

Not every developer has time to learn all the keyboard shortcuts that can improve coding efficiency, so this guide compiles the most common ones for Visual Studio Code.

Join Lines

macOS: Ctrl + J

Ubuntu/Windows: set a custom shortcut for editor.action.joinLines via File → Preferences → Keyboard Shortcuts

Format Code (Indentation)

Windows: Shift + Alt + F

macOS: Shift + Option + F

Ubuntu: Ctrl + Shift + I

To permanently enable trimming trailing whitespace, add "files.trimTrailingWhitespace": true to the user settings (or use the Settings UI in newer VS Code versions).

Fold/Unfold Code

Windows/Ubuntu: Ctrl + Shift + [ to fold, Ctrl + Shift + ] to unfold

macOS: Command + Option + [ to fold, Command + Option + ] to unfold

Move Line Up/Down

Windows: Shift + Alt + Up/Down

macOS: Shift + Option + Up/Down

Ubuntu: Ctrl + Shift + Alt + Up/Down

Split Editor

Windows: Shift + Alt + \ (or 2, 3, 4)

macOS: Command + \ (or 2, 3, 4)

Ubuntu: Shift + Alt + \ (or 2, 3, 4)

Creating an empty editor group can be prevented from auto‑closing by setting "workbench.editor.closeEmptyGroups": false .

Select Word

Windows: Ctrl + D

macOS: Command + D

Ubuntu: Ctrl + D

Repeated use selects the next occurrence of the word.

Toggle Sidebar

Windows/Ubuntu: Ctrl + B

macOS: Command + B

Closing the sidebar provides more horizontal space for code.

Go to Line

All platforms: Ctrl + G (or Ctrl + P then : followed by the line number)

File Symbol Navigation

Windows/Ubuntu: Ctrl + Shift + O

macOS: Command + Shift + O

Symbols can be grouped with @: .

Workspace Symbol Navigation

All platforms: Ctrl + T (macOS: Command + T )

Delete Word

Windows/Ubuntu: Ctrl + Backspace

macOS: Option + Delete

Add Multiple Cursors

Windows/Ubuntu: Ctrl + Alt + Up/Down

macOS: Command + Alt + Up/Down

Rename Symbol

All platforms: F2 (renames all references in the current context)

Block Selection

Windows/Ubuntu: Shift + Alt

macOS: Shift + Option

Hold the key and drag the mouse to create a rectangular selection, adding a cursor to each line.

Command Palette

Windows/Ubuntu: Ctrl + P

macOS: Command + P

The palette shows all available commands and their shortcuts, allowing quick access to actions such as opening files.

Overall, mastering these shortcuts can significantly speed up development workflows in VS Code.

productivitydevelopment toolsVS Codekeyboard shortcuts
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.