在 vscode 中更改集成终端标题
Change Integrated Terminal title in vscode
我们可以使用 View
菜单中的 Integrated Terminal
功能在 vscode 中打开命令提示符。
我们甚至可以打开多个终端,如下所示:
有什么办法可以更改终端的标题吗?
- 1: cmd.exe 将 构建终端
- 2: cmd.exe 将是 watch 终端
我已经阅读了 integrated terminal 文档,但没有找到方法。
按 windows Ctrl + Shift + P 然后输入:Terminal: Rename,在那里你可以 更改终端 name/title
有时,插件会删除默认的键盘快捷键绑定。
在键盘快捷键中查找 "terminal.rename",然后将键盘快捷键编辑为您喜欢的快捷键。
要应用您的快捷方式,请确保您的光标在键入之前聚焦在 window 的编辑部分。而不是在终端部分。
在 v1.41 中有一个新命令,可以像这样使用:
{
"key": "ctrl+t",
"command": "workbench.action.terminal.renameWithArg",
"args": {
"name": "remote"
}
}
如果您有一些经常使用的名称,例如您经常使用的“remote”或“build”。
在 v1.61 中,可以使用变量设置终端名称。参见 terminal custom titles in release notes。
Terminal names are traditonally the name of the process they're
associated with. Thus, it can be difficult to distinguish between
them.
We now support configuring both title and description to help with
this using variables described in terminal.integrated.tabs.title
and
terminal.integrated.tabs.description
settings.
The current default values are:
{
"terminal.integrated.tabs.title": "${process}",
"terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
可用的变量是:
${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.
看起来 ${task}
变量就是您要查找的内容。
使用 VSCode 1.63(2021 年 11 月),输入“<blank>
”(即空字符串)作为名称将恢复该终端的默认名称。
例如:
If my setting is ${cwd}${separator}${process}
and I name a terminal "foo
".
How do I reset "foo
" back to the value of ${cwd}${separator}${process}
?
My suggestion was that if you attempted to submit a blank name that would automatically reset to the value of your setting.
我们可以使用 View
菜单中的 Integrated Terminal
功能在 vscode 中打开命令提示符。
我们甚至可以打开多个终端,如下所示:
- 1: cmd.exe 将 构建终端
- 2: cmd.exe 将是 watch 终端
我已经阅读了 integrated terminal 文档,但没有找到方法。
按 windows Ctrl + Shift + P 然后输入:Terminal: Rename,在那里你可以 更改终端 name/title
有时,插件会删除默认的键盘快捷键绑定。
在键盘快捷键中查找 "terminal.rename",然后将键盘快捷键编辑为您喜欢的快捷键。
要应用您的快捷方式,请确保您的光标在键入之前聚焦在 window 的编辑部分。而不是在终端部分。
在 v1.41 中有一个新命令,可以像这样使用:
{
"key": "ctrl+t",
"command": "workbench.action.terminal.renameWithArg",
"args": {
"name": "remote"
}
}
如果您有一些经常使用的名称,例如您经常使用的“remote”或“build”。
在 v1.61 中,可以使用变量设置终端名称。参见 terminal custom titles in release notes。
Terminal names are traditonally the name of the process they're associated with. Thus, it can be difficult to distinguish between them.
We now support configuring both title and description to help with this using variables described in
terminal.integrated.tabs.title
andterminal.integrated.tabs.description
settings.The current default values are:
{
"terminal.integrated.tabs.title": "${process}",
"terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
可用的变量是:
${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.
看起来 ${task}
变量就是您要查找的内容。
使用 VSCode 1.63(2021 年 11 月),输入“<blank>
”(即空字符串)作为名称将恢复该终端的默认名称。
例如:
If my setting is
${cwd}${separator}${process}
and I name a terminal "foo
".
How do I reset "foo
" back to the value of${cwd}${separator}${process}
?
My suggestion was that if you attempted to submit a blank name that would automatically reset to the value of your setting.