Working on a side project tonight and ran into a problem that I’ve hit many times before: launching vscode from the command line. So many times I’ve wanted to just open a file or folder up in vscode from the command line, but have been too lazy to update my bash file to set it. Today I found out: there’s no need to do that.
Vscode handles this for you now, right inside the editor. As outlined in this stackoverflow post, all you have to do is:
- Open up vscode
Pto bring up the vscode console
- Search for
- Hit enter and vscode does its magic
You’re now good to go with opening either folders or files using
code straight from the command line. No need to reload or restart terminal instances.
To open the current folder in a new instance of code, use
To open a specific file with code, use
Super easy, I wish I had done it a long time ago. So much time wasted…