在vscode中更改集成终端标题

Gan*_*nnu 8 visual-studio-code vscode-extensions vscode-settings

我们可以使用菜单中的Integrated Terminal功能在vscode中打开命令提示符View.

我们甚至可以打开多个终端,如下所示:

集成终端 有什么办法可以改变终端的标题吗?

  • 1:cmd.exe构建终端
  • 2:cmd.exe将是终端

我已经完成了集成的终端文档,但我没有找到办法.

小智 31

按下窗口Ctrl + Shift + P,然后键入:终端:重命名,您可以那里更改终端名称/标题

  • 对于 Mac,它是 cmd + shift + p (4认同)

Mar*_*ark 12

在 v1.61 中,可以使用变量设置终端名称。请参阅发行说明中的​​终端自定义标题

传统上,终端名称是与其关联的进程的名称。因此,很难区分它们。

我们现在支持配置标题和描述,以帮助使用terminal.integrated.tabs.titleterminal.integrated.tabs.description设置中描述的变量来实现此目的。

当前的默认值为:

{
  "terminal.integrated.tabs.title": "${process}",
  "terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
Run Code Online (Sandbox Code Playgroud)

可用的变量有:

${cwd} - The terminal's current working directory  
${cwdFolder} - The terminal's current working directory.  
${workspaceFolder} - The workspace in which the terminal was launched.  
${local} - Indicates a local terminal in a remote workspace.  
${process} - The name of the terminal process.  
${separator} - A conditional separator (" - ") that only shows when surrounded by variables with values or static text.  
${sequence} - The name provided to xterm.js by the process.  
${task} - Indicates this terminal is associated with a task.  
Run Code Online (Sandbox Code Playgroud)

看起来该${task}变量就是您正在寻找的内容。