![]() ![]() Using this command you can duplicate the selected code either above or below the current code. OPTION + SHIFT + UP / DOWN : Duplicate selection up or down ![]() It allows us to format the current document according to the configured settings.ġ4. Often we have extensions enabled or settings configured to format documents on save but sometimes we like to control when we want to format the document. (Windows: SHIFT+ALT+F, Linux: CTRL+SHIFT+I) This is especially helpful when you want to refer to content from a file while coding in another. You can split your editor view to open multiple files together. This command helps you open the terminal when you need it One of the most amazing features of VSCode is that it supports an integrated terminal which you can use just like a normal terminal and to run code or perform other operations. When you want to move a piece of code, for example, a variable declaration either up or down, you cut and paste it to the appropriate place but if the readjustment is for a few lines you can use this command to move the current line/selection up or down You can unfold the code block with CMD + OPTION + ] (Windows/Linux: CTRL + SHIFT + ] )ġ0. This folds the block closest to the cursor. This command is especially useful when we want to focus on a specific area of the code and hence ignore some code blocks. Line comments can be toggled with CMD + / (Windows/Linux: CTRL + /) However, with this shortcut, we can add or remove a block comment for the selected code block or add new ones. We enclose a piece of Javascript code with /* */ to add a block comment. This shortcut also allows us to add a new block comment or toggle existing ones. (Windows: SHIFT + ALT + A, Linux: CTRL+SHIFT+A) SHIFT + OPTION + A : Toggle block comment Often while debugging or developing, I have opened many tabs and when I want to change the context or start fresh, this command comes in very handyĨ. This command is useful when we want to clear all tabs. This is especially helpful in situations when error stack traces provide us the line number of the file and our file is large.ħ. We can navigate to a specific line of the document by using this simple command and typing the line number. Often we use mouse drag to select the text, but if we want to select entire lines, we can use this command If you need to undo cursor selection in a case where you selected more cursors than required or reset the cursor to a previous position, you can use this command to undo the last cursor action This is especially helpful when you don't want to select all occurrences together Like the above command, this is also used to add cursors but with this, you can add the cursor to the next matching selection. CMD + D: Add cursor to next matching selection ![]() Using this command, you can add cursors to all matching selections in the documentģ. They allow you to replace text or append more text without copy-pasting or requiring you to change it one at a time. One of my favorite features of VSCode is multi cursors. CMD + SHIFT + L: Add cursors to all matching selections You can type the name of the file in the search box and select the file by clicking or by pressing enter on the search result to open the fileĢ. Navigating through files is one of the most common options and this command can come in pretty handy. CMD + P: Opens the palette to search for a file Here is a list of some shortcuts that I have been using for a while and found to be really useful.ĭefault shortcuts are for Mac, while shortcuts for Windows and Linux are mentioned below for each commandġ. While most actions can be found from Menu options, having hands-on keyboard shortcuts can help improve your coding speed by a lot. When writing code, we often require certain formatting actions, and a lot of them are supported by VSCode itself. VSCode is one of the most popular editors for web development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |