visual-studio-code - 更改 VS Code 终端的默认工作目录

标签 visual-studio-code

是否可以在 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/

相关文章:

visual-studio-code - 我无法在 Visual Studio Code 中使用完整缓冲区视口(viewport)

c++ - 尝试使用 boost 和 ncurses 库编译程序时出现错误

visual-studio-code - 如何在 VS 代码中设置 Julia?

visual-studio-code - 默认 Powershell 终端为 7.2,但脚本以 Powershell 5.1 运行

c++ - vs 代码在 macOS monterey 上抛出#include 错误它在 BigSur 上运行良好

visual-studio-code - 如何在 VS Code 中复制 Interactive Playground 页面的文本?

visual-studio-code - 转到 .jsx 的定义不起作用

android-studio - 如何在Flutter Dev Tool中启用 'Performance Overlay'

typescript - Deno:VSCode typescript 不知道 ES6

visual-studio-code - 如何使用 VS Code 调试 Singer Tap