VSCode shortcuts that make me more productive

I realised that for a long time my main focus was centred around the code that I was writing (on things like performance, readability, using the latest and the greatest … etc) but as I spend the majority of the day writing code, learning to write, navigate, refactor faster should be at least as important.

Let’s start with some basic shortcuts:

These ones I use the most.

  • CMD + W: closing current tab
  • CMD + ’+’ or ’-’: making the window bigger / smaller
  • CMD + /: comment the current line
  • CMD + delete: delete the current line
  • CMD + F / CMD + SHIFT + F: search in current file / globally
  • CMD + B: toggle the sidebar
  • CMD + J: toggle the terminal
  • CMD + P + nameOfAFile: jump to a specific file by name
  • CTRL + [1/2/3..]: navigate to the 1st, 2nd, 3rd tab
  • CTRL + space: show suggestion
  • CMD + left or right arrow: navigate to the beginning / end of the line
  • OPTION + left or right arrow: navigate to the previous or next word

Next, the commands I wish to incorporate in my day to day flow:

  • CTRL + J: join multiple lines together
  • CTRL + tabNr: jump to a specific tab (tabs are numbered starting from the left with the value of 1, 0 is actually the last tab on the right)
  • CMD + OPTION + left / right arrow: jump to the left or right tab
  • CMD + OPTION + [ or ]: unfold or fold code regions
  • CMD + P + : followed by lineNumber: jump to a specific line number
  • CMD + G: jump to a specific line number (same as above)
  • CMD + [ or ]: re-indent code either to the left or right
  • OPTION + DELETE: delete previous word (instead of previous character)
  • OPTION + up / down arrow: duplicate the current line above or below
  • CMD + OPTION + up / down arrow: duplicate cursor

Animation

  • SHIFT + OPTION + up / down arrow: column selection

Animation


  • OPTION + DELETE: delete previous word (instead of previous character)

  • CMD + P + @ or CTRL + SHIFT + .: search through all symbols (in file)

  • CMD + P + #: global symbol search

  • SELECT WORD + CMD + D: select and edit the same words with duplicate cursor mode

Extra: my iTerm configuration

As a good IDE must be always accompanied by a few terminals I am going to show you my iTerm setup (even though it’s pretty minimalistic):

What I did is to create two profiles, one would open the terminals from the upper part of the screen and the other from the lower part. The keyboard triggers are SHIFT + _** and **_SHIFT + CAPS +.

Further than that I use CMD + ENTER for entering into the full screen mode, CMD + D / CMD + SHIFT + D for vertical and horizontal splits.


P.S: the articles from which I got inspired:

15 Visual Studio Code Shortcuts You Should Know
The Startup
Brandon Burrus

20 VS Code Shortcuts for Fast Coding
Better Programming
Deepak Gupta

Edit: one year later after publishing this post; the following video really changed my perspective above VSCode:

YouTube Video