skip to Main Content

I would like to make it so that when I’m traversing directories using the integrated terminal, running code . opens the current working directory in the integrated terminal within the current VSCode window, "discarding"/closing the currently opened workspace, instead of opening a new window for that folder. Is this possible? If not, what would be a similar solution?

2

Answers


  1. You can use code -r .

    code --help gives the following description:
    -r --reuse-window Force to open a file or folder in an already opened window.

    Another source is Visual Studio Code Tips and Tricks

    Login or Signup to reply.
  2. As @ltomase found in their answer (and exanding on their answer), you can use the -r option of the code command. The doc comment for this option in the --help menu says this:

    Force to open a file or folder in an already opened window.

    There are other approaches not involving the command-line:

    1. Open command palette and use the File: Open Workspace from File... command to open workspace files (.code-workspace), or

    2. Open command palette and use the File: Open Folder... command to open folders (keyboard shortcut: ctrl+K , ctrl+o).

    3. Use alt+f to open the File menu, then use keyboard navigation to go to "Open Recent" and then select a recent workspace to open.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search