根据当前的终端选项卡打开新的终端选项卡

时间:2018-04-19 01:45:56

标签: visual-studio-code

我在vscode中添加了以下键绑定来打开一个新的终端窗口:

{
  "key": "cmd+t",
  "command": "workbench.action.terminal.new"
}

当我执行cd Desktop之类的命令然后再次运行cmd+t时,新终端从零开始。新终端是否可能基于前一个终端?在我们的例子中,它应该打开一个在/Desktop而不是根目录上运行的新终端选项卡。

我正在使用bash。

1 个答案:

答案 0 :(得分:0)

Add the following to your User Settings (Menu:File > Preferences):

"terminal.integrated.cwd": "Desktop"

This will now open up in Desktop instead of having to cd into it.

I'm not sure how to change the cwd based on other open terminals per your question.Here's the full commented setting in vscode:

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