Conquer VS Code Shortcuts: Tips for writing efficient and effective code!
Are you familiar with VS Code shortcuts? When you're writing code on the keyboard, do you ever wish you could ditch the mouse and just do it all with the keyboard? Knowing some of the powerful shortcuts in VS Code can help alleviate some of that frustration. 😊
Today we've prepared a master class on VS Code shortcuts to make your coding less painful! 💻 I'm not going to lie, shortcuts can help you write code 100x faster (you know you're human!), which means you'll save more time and have more time for a cup of coffee! ☕ Let's dive into the world of VS Code shortcuts together 🚀.
VS Code shortcuts: magical tips to increase your efficiency!
We've organized the most commonly used shortcuts in VS Code into a table below. Keyboard shortcuts, Description., Frequency of use They are listed in order. Print them out and stick them near your monitor so you can stare at them and have them embedded in your brain without realizing it!
Keyboard shortcuts | Description. | Frequency of use |
---|---|---|
Ctrl + Space | HTML tag autocompletion | High |
Ctrl + / | Commenting/Uncommenting | High |
Tab, Shift + Tab | Set indentation | High |
Ctrl + F, Ctrl + H | Search/replace text | High |
Ctrl + P, Ctrl + Tab | Move files/tabs | Medium |
Shift + Alt + F | Code alignment | Medium |
Alt + ↑/↓ | Moving functions | Medium |
Ctrl + Shift + R | Refactoring code | Medium |
Ctrl + C, Alt + ↑/↓, Ctrl + X | Copy/Move/Delete Lines | Medium |
Ctrl + D | Select a word | Medium |
Key shortcut details
Ctrl + Space: Autocomplete HTML tags
This is a useful shortcut for quickly typing HTML tags. Type the start tag and the end tag is automatically completed to save you coding time.
Ctrl + /: Comment/Uncomment
Shortcuts used to comment or uncomment specific parts of code. It makes your code more readable and allows you to execute only the parts you need.
Ctrl + F, Ctrl + H: Search/replace text
Shortcuts for finding or replacing specific words in your code. It's a quick way to find and edit something in a long piece of code.
Alt + ↑/↓: Move lines of code
A shortcut used to move up or down a specific line of code. This is useful when rearranging code or changing its structure.
Tips for using keyboard shortcuts:
- Memorize your favorite shortcuts! Once you get used to it, you'll code even faster 🚀.
- Create a shortcut cheat sheet! Use it as a cheat sheet to refer to whenever you forget. Aging can't help it, love your shortcut cheat sheet! 😉 .
- Create your own shortcuts! (For advanced users) Once you're skilled, you can utilize VS Code to 200%! 💪 See the code box below.
# For advanced users, I leave it this small because it's redundant.
1. open Keyboard shortcut settings
1-1. Run VS Code.
1-2. Click **File** > **Preferences** > **Keyboard Shortcuts** on the menu bar.
2. Search and change keyboard shortcuts
2-1. In the **Keyboard Shortcuts** window that opens, type the command you want to change in the search box at the top. For example, let's search for the command `copy line`.
2-2. Find the command **Copy Line Down** in the search results.
3. Change the shortcut settings
3-1. Double-click the **Copy Line Down** command, or click the pencil icon next to the command.
3-2. When the **Keyboard Shortcut Settings window** appears, enter the new shortcut you want to assign. For example, enter `Ctrl + Alt + D`.
3-3. After entering the keyboard shortcut, press **Enter** to save your settings.
4. Confirm and save settings
4-1. Verify that the new hotkeys are set correctly.
4-2. Now try to copy the current line down using the shortcut `Ctrl + Alt + D`.
Organize
VS Code shortcuts are the essential tools you need to be more efficient when writing code! ✨ Stop clicking your mouse, code in style with shortcuts, and enjoy your free time! Share your shortcuts with your coworkers and friends, you'll be the hip one!
Are you thinking of starting with R language? If you want to know the shortcuts of RStudio, the sister(?) of VS code, click the button below or the post box~.