Everyone knows the saying, “Why waste time say lot word when few word do trick?” No group of people does this motto better apply to than programmers, it’s a big part of our work. While condensing code is important to our work, as it increases readability and allows other developers to understand what our code should be doing.
Keyboard shortcuts help us accomplish the smaller mundane tasks of coding in a way that makes it second nature, rather than constant little tasks that serve to interrupt your workflow.
Here are some of my favorite shortcuts for VSC , I use a pc so my shortcuts will be the windows format, sorry not sorry ;) (substitute CMD for CTRL on MAC),
— These are my most useful shortcuts when working in a file.
- CTRL + F — search for a word/sentence (Alt + C will match case, Alt + W will match the whole word, and Alt + R you can use regular expression)
- CTRL + D — Add selection to Next Find Match.
- CTRL + F2 — Change all occurrences
- CTRL + H — Search and replace.
- CTRL + G — Go to line/column.
- CTRL + SHIFT + K — Delete Line
- CTRL + U — Cursor Undo
- ALT + CLICK — Repeat cursor.
- ALT + UP/DOWN ARROW — Move current line up/down.
- CTRL + ALT + UP/DOWN ARROW — Add cursor above/below
- CTRL + SHIFT + ENTER — Insert line above
- CTRL + ENTER — Insert line below
- CTRL +RIGHT/LEFT ARROW — Move cursor to the end of the word to it’s right/left.
- CTRL + SHIFT +RIGHT/LEFT ARROW — Move cursor to the end of the word to it’s right/left and select it.
— These are my most useful shortcuts for navigating through VSC.
- CTRL + Tab — Navigate between files.
- CTRL + B — Open/close side bar. (Ctrl + Shift + E explorer view, Ctrl + Shift + F search whole project, Ctrl + Shift + G git options, Ctrl + Shift + D debug options, Ctrl + Shift + X extensions panel).
- CTRL + | — Split editor.
- CTRL + SHIFT + T — Reopen a closed editor.
- CTRL + K, SHIFT +ENTER — Pin an open editor.
- CTRL + W — Close current window.
- CTRL + N — New tab.
- CTRL + Shift + N — New window.
- CTRL +K, Z — Toggle Zen mode.
- CTRL+K, CTRL+R — Open keyboard shortcuts reference.
Now these are lot of shortcuts, and it’ll take some time before they’re committed to memory. Try some out and figure out which ones you think are the most helpful! Don’t worry if you accidentally enter the wrong shortcut, you can always use the shortcut for undo the reverse any changes.
These are the most practical shortcuts in my opinion, but take a look into the keyboard shortcuts reference (CTRL+L , CTRL+R) to see the many, different shortcuts that are there. You are also able to rebind any of these shortcuts, so if you don’t like one, you can change it!