Sometimes, a statement written in a single line turns out to be a lot more readable than multi-line statements. Mac: cmd+\ or cmd then select a file from the File Explorer.
Split view is very useful when comparing or editing two or more related files. So that you can have multiple files open at the same time on the screen. VS Code allows you to use split view while editing your files. Alternatively, you can also toggle Auto Save from by navigating to File > Auto Save.Open settings.json with Ctrl +, (Mac: cmd + ,).While VS Code keeps your changes in memory so that you can manually save them later if you want you can enable auto saving of your work by following the steps given below. Need more screen space? With this shortcut, you can quickly expand/collapse the sidebar when not in use.įorgetting to save your changes might lead you to run old code while testing. Pretty useful when you have to make similar edits at multiple places! You can easily replace the text as well as start writing at each occurrence simultaneously. It automatically adds multiple cursors at each occurrence. You can quickly select all occurrences of a find operation using this shortcut. Remove commenting from current or multiple selected lines by using:ġ0. Use the following shortcut to comment the current line or multiple lines if they are selected: Use the following shortcut to achieve that:Ĭommenting out old code to test some newly written lines of code? VS Code can make the whole process much simpler by allowing you to turn multiple lines into comments at once.
You can quickly delete the current line in one go instead of having to press the backspace or select the whole line. In case you want to add cursors at different places manually, you can use Alt+Left Click Mac: opt+cmd+up or opt+cmd+down Add multiple cursors in vs code You can add cursors above/below the current line by the following shortcut keys: Multiple cursors in VS code are great time savers when you want to make the same edits at multiple places. Mac: opt+Up/Down Arrow Move line up/down in vs code Want to move a certain piece of code to a different place in the current file? Skip the usual Cut-Paste and simply move the current line or selection up/down by using this shortcut: Use the following key combination to achieve that: One such shortcut allows you to expand your selection word by word. Instead of using click and drag to select the text, you can go for various keyboard shortcuts that enhance both speed and precision. You can save a lot of time and avoid accidental deletion caused by the usual way of holding down Backspace. If you ever want to search for a piece of text in all your current project files, VS Code allows you to do that by either clicking the Search icon on the sidebar or by using the following keyboard shortcut: You can access the command palette by the following key combination: Simply start typing what you want VS Code to do in the command palette and it will come up with all sorts of suggested commands to help you out. Or you might want to simply change some settings, disable all extensions and you don’t want to go through the hassle of finding out where that option exists. Let’s say you want to format your code and don’t remember the shortcut. It presents to you every functionality, shortcut, and configuration options in the form of a searchable list. The Command Palette will probably turn out to be the most used feature of VS Code for you if you are new to the editor. Or by going to View > Appearance > Toggle Zen Mode. Zen mode is a distraction-free view, allowing you to focus completely on your code and hide all the toolbars and buttons. This blog will take you through the most useful visual studio code shortcut keys, features, and the best extensions to boost your productivity and transform you into a VS Code Ninja! VS Code Shortcuts for Beginners 1.
#Visual studio code collapse all shortcut full#
If you are new to VS code and want to know the most useful shortcuts to take full advantage of this awesome code editor, you have arrived at the right place.