visual-studio-code - 更改 VS Code 终端的默认工作目录
问题描述
是否可以在 Visual Studio Code 中更改新集成终端窗口的工作目录?
我已经/path/to/project
在 Code 中打开了该文件夹,因此当我打开一个新的终端窗口时,它会在该文件夹中启动。我希望终端打开,/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": "",
这可以添加到settings.json
文件.vscode
夹中。支持绝对路径和相对路径,因此
"terminal.integrated.cwd": "app"
和
"terminal.integrated.cwd": "/path/to/project/app"
两者都可以。
推荐阅读
- c# - 如何从 TextBox 获取值并自动应用格式?
- r - 如何使用 R 中的循环从多个数据帧(数量可能不同)中删除列
- c# - 自动运行控制台应用程序不需要点击 .exe 文件
- android - 如何调整 NavigationView 中图标和标题之间的间距?
- android - android.os.FileUriExposedException 统一用于 Android +7.0
- express-gateway - 安装的每个策略都必须来自一个包吗?(快速网关)
- c++ - 从PID检索进程运行目录
- jquery - 长下拉菜单 - 否
- 属性如何使其滚动?
- excel - 当以特定模式输入数据时,将数字转换为时间
- c# - 图像未在正确的位置绘制