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.
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 Action | Windows keyboard Shortcut | Mac keyboard Shortcut | Linux keyboard Shortcut |
---|---|---|---|
To Show Command Palette | Ctrl+Shift+P, F1 | ⇧⌘P, F1 | Ctrl+Shift+P, F1 |
To Open or Go to File | Ctrl+P | ⌘P | Ctrl+P |
New visual code window or instance | Ctrl+Shift+N | ⇧⌘N | Ctrl+Shift+N |
To Close window or instance | Ctrl+Shift+W | ⌘W | Ctrl+Shift+W |
To open User Settings | Ctrl+, | ⌘, | Ctrl+, |
To open Keyboard Shortcuts | Ctrl+K Ctrl+S | ⌘K ⌘S | Ctrl+K Ctrl+S |
Cut line (empty selection) | Ctrl+X | ⌘X | Ctrl+X |
Copy line (empty selection) | Ctrl+C | ⌘C | Ctrl+C |
Move line up/down | Alt+ ↑ / ↓ | ⌥↓ / ⌥↑ | Alt+ ↑ / ↓ |
Copy line up/down | Shift+Alt + ↓ / ↑ | ⇧⌥↓ / ⇧⌥↑ | Shift+Alt + ↓ / ↑ |
Delete line | Ctrl+Shift+K | ⇧⌘K | Ctrl+Shift+K |
Insert line below | Ctrl+Enter | ⌘Enter | Ctrl+Enter |
Insert line above | Ctrl+Shift+Enter | ⇧⌘Enter | Ctrl+Shift+Enter |
Add line comment | Ctrl+K Ctrl+C | ⌘K ⌘C | Ctrl+K Ctrl+C |
Remove line comment | Ctrl+K Ctrl+U | ⌘K ⌘U | Ctrl+K Ctrl+U |
Toggle line comment | Ctrl+/ | ⌘/ | Ctrl+/ |
Toggle block comment | Shift+Alt+A | ⇧⌥A | Shift+Alt+A |
Go to Line... | Ctrl+G | ⌃G | Ctrl+G |
Find | Ctrl+F | ⌘F | Ctrl+F |
Replace | Ctrl+H | ⌥⌘F | Ctrl+H |
Find next/previous | F3 / Shift+F3 | ⌘G / ⇧⌘G | F3 / Shift+F3 |
Select all occurrences of Find match | Alt+Enter | ⌥Enter | Alt+Enter |
Add selection to next Find match | Ctrl+D | ⌘D | Ctrl+D |
Move last selection to next Find match | Ctrl+K Ctrl+D | ⌘K ⌘D | Ctrl+K Ctrl+D |
Select current line | Ctrl+I | ⌘I | Ctrl+I |
Select all occurrences of current selection | Ctrl+Shift+L | ⇧⌘L | Ctrl+Shift+L |
Close editor | Ctrl+F4, Ctrl+W | ⌘W | Ctrl+W |
Close folder | Ctrl+K F | ⌘K F | Ctrl+K F |
New File | Ctrl+N | ⌘N | Ctrl+N |
Open File... | Ctrl+O | ⌘O | Ctrl+O |
Save | Ctrl+S | ⌘S | Ctrl+S |
Save As... | Ctrl+Shift+S | ⇧⌘S | Ctrl+Shift+S |
Save All | Ctrl+K S | ⌥⌘S | Ctrl+K S |
Close / Close All | Ctrl+F4 / Ctrl+K Ctrl+W | ⌘W / ⌘K ⌘W | Ctrl+W / Ctrl+K Ctrl+W |
Toggle full screen | F11 | ⌃⌘F | F11 |
Show Search | Ctrl+Shift+F | ⇧⌘F | Ctrl+Shift+F |
Show Extensions | Ctrl+Shift+X | ⇧⌘X | Ctrl+Shift+X |
Replace in files | Ctrl+Shift+H | ⇧⌘H | Ctrl+Shift+H |
Show Output panel | Ctrl+Shift+U | ⇧⌘U | Ctrl+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
2 comments
hello world
hello. topic for me thanks kelly