Visual Studio Code Keyboard Shortcuts

Visual Studio Code Keyboard Shortcuts

Visual Studio Code Keyboard Shortcuts

Visual Studio Code is the go-to code editor for Salesforce developers. It’s free, open-source, and available for Windows, Linux, and macOS. This editor has easy-to-install extensions for syntax highlighting, code completion, and more. Visual Studio Code can be used with many programming languages. Here in this post, we will see some keyboard shortcuts for visual studio code which might help in increasing productivity for developers.

Visual Studio Code Keyboard Shortcuts

Here is list of VS Code Keyboard Shortcuts:

  • To Show Command Palette: Ctrl+Shift+P, F1
  • To Open or Go to File: Ctrl+P
  • New visual code window or instance: Ctrl+Shift+N
  • To Close window or instance: Ctrl+Shift+W
  • To open User Settings: Ctrl+,
  • To open Keyboard Shortcuts: Ctrl+K Ctrl+S
  • Cut line (empty selection): Ctrl+X
  • Copy line (empty selection): Ctrl+C
  • Move line up/down: Alt+ ↑ / ↓
  • Copy line up/down: Shift+Alt + ↓ / ↑
  • Delete Line: Ctrl+Shift+K
  • Insert line below: Ctrl+Enter
  • Insert line above: Ctrl+Shift+Enter
  • Add line comment: Ctrl+K Ctrl+C
  • Remove line comment: Ctrl+K Ctrl+U
  • Toggle line comment: Ctrl+/
  • Toggle block comment: Shift+Alt+A
  • Go to Line…: Ctrl+G
  • Find: Ctrl+F
  • Find next/previous: F3 / Shift+F3
  • Select all occurrences of Find match: Alt+Enter

 

Here is VS Code Keyboard Shortcuts for Windows, Mac and linux

Command ActionWindows keyboard ShortcutMac keyboard ShortcutLinux keyboard Shortcut
To Show Command PaletteCtrl+Shift+P, F1⇧⌘P, F1Ctrl+Shift+P, F1
To Open or Go to FileCtrl+P⌘PCtrl+P
New visual code window or instanceCtrl+Shift+N⇧⌘NCtrl+Shift+N
To Close window or instanceCtrl+Shift+W⌘WCtrl+Shift+W
To open User SettingsCtrl+,⌘,Ctrl+,
To open Keyboard ShortcutsCtrl+K Ctrl+S⌘K ⌘SCtrl+K Ctrl+S
Cut line (empty selection)Ctrl+X⌘XCtrl+X
Copy line (empty selection)Ctrl+C⌘CCtrl+C
Move line up/downAlt+ ↑ / ↓⌥↓ / ⌥↑Alt+ ↑ / ↓
Copy line up/downShift+Alt + ↓ / ↑⇧⌥↓ / ⇧⌥↑Shift+Alt + ↓ / ↑
Delete lineCtrl+Shift+K⇧⌘KCtrl+Shift+K
Insert line belowCtrl+Enter⌘EnterCtrl+Enter
Insert line aboveCtrl+Shift+Enter⇧⌘EnterCtrl+Shift+Enter
Add line commentCtrl+K Ctrl+C⌘K ⌘CCtrl+K Ctrl+C
Remove line commentCtrl+K Ctrl+U⌘K ⌘UCtrl+K Ctrl+U
Toggle line commentCtrl+/⌘/Ctrl+/
Toggle block commentShift+Alt+A⇧⌥AShift+Alt+A
Go to Line...Ctrl+G⌃GCtrl+G
FindCtrl+F⌘FCtrl+F
ReplaceCtrl+H⌥⌘FCtrl+H
Find next/previousF3 / Shift+F3⌘G / ⇧⌘GF3 / Shift+F3
Select all occurrences of Find matchAlt+Enter⌥EnterAlt+Enter
Add selection to next Find matchCtrl+D⌘DCtrl+D
Move last selection to next Find matchCtrl+K Ctrl+D⌘K ⌘DCtrl+K Ctrl+D
Select current lineCtrl+I⌘ICtrl+I
Select all occurrences of current selectionCtrl+Shift+L⇧⌘LCtrl+Shift+L
Close editorCtrl+F4, Ctrl+W⌘WCtrl+W
Close folderCtrl+K F⌘K FCtrl+K F
New FileCtrl+N⌘NCtrl+N
Open File...Ctrl+O⌘OCtrl+O
SaveCtrl+S⌘SCtrl+S
Save As...Ctrl+Shift+S⇧⌘SCtrl+Shift+S
Save AllCtrl+K S⌥⌘SCtrl+K S
Close / Close AllCtrl+F4 / Ctrl+K Ctrl+W⌘W / ⌘K ⌘WCtrl+W / Ctrl+K Ctrl+W
Toggle full screenF11⌃⌘FF11
Show SearchCtrl+Shift+F⇧⌘FCtrl+Shift+F
Show ExtensionsCtrl+Shift+X⇧⌘XCtrl+Shift+X
Replace in filesCtrl+Shift+H⇧⌘HCtrl+Shift+H
Show Output panelCtrl+Shift+U⇧⌘UCtrl+K Ctrl+H

 

VS Code shortcuts

vs code comment shortcut

In vscode many time we have to comment/uncomment the line of code or block of code from time to time. We can select a block of code and use the key sequence Ctrl+K+C, it will comment out the section of code.  Ctrl+K+U will uncomment the code. It will be a line comment. For Block Comment, we can select lines of code and use Shift+Alt+A. It will toggle comments on and off. You can mac shortcut for same in above table.

VS Code Navigate Forward/Backward Ctrl+–/Ctrl+Shift+–

When we have multiple files open at the same time, we might need a way to quickly move back and forth between two or three different locations in your code. If we have moved from one location to another we can use the keyboard sequence Ctrl+– to move to the previous location and then you can return using Ctrl+Shift+–.

VS Code Open Command Palette

Ctrl+Shift+P : The command palette is very useful in VS Code. We can simply use Ctrl+Shift+P in windows and ⇧⌘P(Command + Shift+ P) for mac to open command Palette.

VS Code Go To Line

To go to a line in the file, you use ctrl + g, then type a line number. Alternatively, you can also open the go-to file menu with command + p first. Then type :. Then type your line number. In mac shortcut is ⌃G

VS Code Search in all Files

Searching  in all files is very useful and used very frequently by developers. Search all Windows Shortcut is Ctrl+Shift+F. Search all Mac shortcut is ⇧⌘F(Command+Shift+F).

For more details please refer to official link

Permanent link to this article: https://www.sfdcpoint.com/salesforce/visual-studio-code-keyboard-shortcuts/

1 comment

    • ThimiJagRaime on May 26, 2020 at 8:40 am

    hello world

Leave a Reply

Your email address will not be published.