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?
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
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
As @ltomase found in their answer (and exanding on their answer), you can use the
-r
option of thecode
command. The doc comment for this option in the--help
menu says this:There are other approaches not involving the command-line:
Open command palette and use the
File: Open Workspace from File...
command to open workspace files (.code-workspace
), orOpen command palette and use the
File: Open Folder...
command to open folders (keyboard shortcut: ctrl+K , ctrl+o).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.