Ever since I shifted to VSCode, I have been amazed at the rich feature set it offers. These features have made it possible for me to maintain my flow state while getting work done. Keybinds are by far my favorite feature. Paired with coding assistants like Kite, VSCode becomes the powerhouse that programmers yearn for. Here are some keybindings I find myself using all the time.

Create multiple cursors

Create multiple cursors anywhere you want

Create multiple cursors anywhere you want

Hold down the Alt key and click where you want the cursor to appear. This is incredibly useful while prefixing or suffixing multiple variables at the same time. It is a neat alternative to find and replace. You can take this a step further by holding down the Alt key, then dragging vertically to create cursors. This saves you multiple mouse clicks.


Select Next Occurrence

Image for post

Select All Occurrences

Select the text you want to search, hold Ctrl then hit D for every occurrence you want to find. Here we are finding all occurrences(8) of ‘AdmissionEx’ and replacing it with ‘AdEx’. This allows for simultaneous editing with multiple cursors.


Move Line Up/Down

Image for post

Move the entire line up/down

Go to the line you want to move, hold Alt then press the directional arrows as many times as you want to move the line. This is especially helpful for procedural oriented languages like C, Python where the flow of the program matters. This saves the time you spend selecting the statement, deleting it then retyping it to its new position.


Fold/Unfold All

Image for post

Folding the Routes then Unfolding them

Hold Ctrl, K, 0(Zero) to fold all the foldable part of the code. This folds every section recursively. If you want to fold in levels, replace 0 with the level you want to fold. To fold only up to 2 levels, hold Ctrl+K+2. To unfold them, press Ctrl(hold)+K+J. This makes getting in and out of methods really easy.


Line Comment

  • Go to the line you want to comment, press Ctrl + /. This comments out the line. Similarly, if you want to comment out multiple lines, select the lines and press Ctrl+/. I use this all the time for debugging purposes. This is by far my most used keybind after ctrl+C and ctrl+V.

Image for post

Commenting line

  • To comment out an entire folded section, select the statement that represents the section and the line below it. Now comment these out. You will notice that the section unfolds after you comment it out. This is because the section is no longer a valid piece of code but a bunch of lines that do not affect the code.

#coding #productivity #programming #vscode #tips

VSCode Keybinds to Speed up Your Work
1.25 GEEK