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 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 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 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.
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.
Commenting line
#coding #productivity #programming #vscode #tips