Answer a question

Is it possible to change the working directory for new integrated terminal windows in Visual Studio Code?

I have opened the folder /path/to/project in Code, so when I open a new terminal windows, it starts in that folder. I would like the terminal to open in /path/to/project/app so that I don't have to cd to that folder every time. Is it possible to configure this in settings.json?

Answers

It turns out this was fairly easy to find in the documentation at https://code.visualstudio.com/docs/getstarted/settings.

The setting that controls this is

  // 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": "",

This can be added to settings.json in the .vscode folder. Absolute and relative paths are supported, so

"terminal.integrated.cwd": "app"

and

"terminal.integrated.cwd": "/path/to/project/app"

will both work.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐