Leonhard Euler
Leonhard Euler

Reputation: 169

How to have different shortcuts open different workspace in vscode

I tend to use vscode for doing a lot of my coding these days. I have a workspace for vhdl, python, and latex. I sometimes have to switch between them several times a day. I wonder if there's a way, such as creating a shortcut, that would automatically launch vscode with the workspace loaded so that I don't have to do it manually.

Upvotes: 0

Views: 114

Answers (1)

Mark
Mark

Reputation: 180621

You can create a keybinding like:

{
  "key": "alt+q",         // whatever keybindings you want
  "command": "workbench.action.terminal.sendSequence",
  "args": { "text": "code -n '<absolute path to folder>'\u000D" }
},

It just sends that line to the terminal, see Core CLI Options. Replace with the path to your other workspace folders. The path separators may have to be double escaped like C:\\Users\\Mark\\etc.... The \u000D is a return so it runs immdeiately.

Upvotes: 2

Related Questions