Introduction:
Visual Studio Code shortcuts are key combinations you can use to do tasks quickly without clicking around. They help you work faster and smoother in the Visual Studio Code editor. These shortcuts save time by keeping your hands on the keyboard instead of moving to the mouse.
Advantages:
Using these shortcuts makes coding faster. You don’t have to search for buttons or menus, so you finish tasks quicker. They also help avoid mistakes because you can stay focused on the code without interruptions. By using shortcuts, you become more efficient and better at coding.
Additionally, shortcuts help in learning new ways to use the editor. They make complex tasks simpler, allowing you to do more with less effort. This improves your overall experience and helps you become a more skilled developer.
Basic Navigation:
- Ctrl + P : Open file by name
- Ctrl + Tab : Switch between open files
- Ctrl + G : Go to line
- Ctrl + ` : Toggle terminal
- Ctrl + Shift + ` : Create new terminal
- Ctrl + B : Toggle Sidebar
- Ctrl + ` : Toggle integrated terminal
Editing Shortcuts:
- Ctrl + D : Select word (repeat to select others)
- Alt + Click : Add cursor
- Ctrl + Shift + L : Select all occurrences of current selection
- Alt + Up/Down : Move line(s) up/down
- Ctrl + X : Cut line
- Ctrl + Enter : Insert line below
- Ctrl + Shift + Enter : Insert line above
- Ctrl + Shift + K : Delete line
- Alt + Shift + Down/Up : Copy line down/up
- Ctrl + / : Toggle line comment
- Shift + Alt + A : Toggle block comment
Advanced Navigation:
- Ctrl + Shift + O : Go to symbol
- Ctrl + Shift + P : Open command palette
- Ctrl + Shift + F : Search in files
- Ctrl + Shift + E : Focus on Explorer
- Ctrl + Shift + M : Focus on Problems
Code Folding:
- Ctrl + Shift + [ : Fold (collapse) region
- Ctrl + Shift + ] : Unfold (expand) region
- Ctrl + K, Ctrl + [ : Fold all subregions
- Ctrl + K, Ctrl + ] : Unfold all subregions
Debugging:
- F5 : Start debugging
- F9 : Toggle breakpoint
- F10 : Step over
- F11 : Step into
- Shift + F5 : Stop debugging
Version Control:
- Ctrl + Shift + G : Open source control
- Ctrl + Shift + D : View changes
Integrated Terminal:
- Ctrl + ` : Show/hide terminal
- Ctrl + Shift + ` : Create new terminal
File Operations:
- Ctrl + N : New file
- Ctrl + S : Save file
- Ctrl + Shift + S : Save As…
- Ctrl + W : Close editor
- Ctrl + Shift + T : Reopen closed editor
Search and Replace:
- Ctrl + F : Find
- Ctrl + H : Replace
- F3 / Shift + F3 : Find next/previous occurrence
Multi-Cursor and Selection:
- Alt + Click : Add cursor
- Ctrl + D : Add next occurrence to selection
- Ctrl + U : Undo last cursor operation
- Ctrl + Alt + Up/Down : Insert cursor above/below
Zen Mode and Full Screen:
- Ctrl + K, Z : Zen mode (focus on current file)
- F11 : Toggle full screen
Code Formatting:
- Shift + Alt + F : Format document
- Ctrl + K, Ctrl + F : Format selection
Miscellaneous:
- Ctrl + K, S : Keyboard shortcuts reference
- Ctrl + , : Open Settings
- Ctrl + Shift + P, F : Toggle word wrap
Navigation and Bookmarks:
- Ctrl + Shift + . : Toggle through different views (e.g., editor, terminal)
- Ctrl + K, Ctrl + M : Focus on Problems panel
- Ctrl + K, Ctrl + H : Focus on Output panel
- Ctrl + K, Ctrl + X : Focus on Extensions panel
- Ctrl + K, Ctrl + B : Toggle Sidebar visibility
Window Management:
- Ctrl + 1-9 : Switch to a specific tab (1-9)
- Ctrl + W : Close active editor
- Ctrl + Shift + W : Close current window
Snippets and Code Insertion:
- Ctrl + Space : Trigger suggestion
- Ctrl + Shift + Space : Trigger parameter hints
- Ctrl + Shift + Enter : Complete statement (adds missing parentheses, braces, etc.)
Integrated Terminal Shortcuts:
- Ctrl + Shift + C : Copy selection
- Ctrl + Shift + V : Paste into terminal
- Ctrl + Shift + Up/Down : Scroll up/down in terminal
Markdown Preview:
- Ctrl + Shift + V : Open preview (for Markdown files)
Emmet Abbreviations:
- Various shortcuts for generating HTML/CSS snippets using Emmet (e.g.,
!
for HTML scaffold)
Conclusion:
Visual Studio Code shortcuts are super helpful. They speed up your work, reduce mistakes, and make coding easier. By practicing these shortcuts, you become a more efficient coder and can do more in less time. They’re like secret tricks that help you master your code editor and level up your coding game.