是否可以在 Visual Studio Code 中更改新集成终端窗口的工作目录?
我已经在 Code 中打开了文件夹 /path/to/project
,所以当我打开一个新的终端窗口时,它会从该文件夹开始。我希望终端在 /path/to/project/app
中打开,这样我就不必每次都cd 到该文件夹。是否可以在 settings.json
中进行配置?
最佳答案
事实证明,这很容易在 https://code.visualstudio.com/docs/getstarted/settings 的文档中找到。 .
控制这个的设置是
// An explicit start path where the terminal will be launched, this is used
as the current working directory (cwd) for the shell process. This may be
particularly useful in workspace settings if the root directory is not a convenient cwd.
"terminal.integrated.cwd": "",
这可以添加到 .vscode
文件夹中的 settings.json
中。支持绝对和相对路径,因此
"terminal.integrated.cwd": "app"
和
"terminal.integrated.cwd": "/path/to/project/app"
都可以。
关于visual-studio-code - 更改 VS Code 终端的默认工作目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62850967/