43

We can open command prompt in vscode by using the Integrated Terminal feature in View menu.

We can even open multiple terminals as shown below:

Integrated terminal Is there any way I can change the title of the terminal ?

  • 1: cmd.exe will be build terminal
  • 2: cmd.exe will be watch terminal

I have gone through the integrated terminal documentation but I didn't find a way to do that.

Gangadhar Jannu
  • 4,136
  • 6
  • 29
  • 49
  • 2
    I'm interested in the same thing, I'de like to be able to change the title so I know the hostname of machine I've ssh'd to – Roman May 08 '17 at 18:37
  • Sadly microsoft closed and locked the feature request at https://github.com/Microsoft/vscode/issues/63264 and now we need an extension for auto-renaming terminal windows, as manual renaming is close to useless for practical use. – sorin Jul 24 '21 at 09:01

5 Answers5

84

Press in windows Ctrl + Shift + P and after type: Terminal: Rename, there you can change the terminal name/title

diarcastro
  • 856
  • 8
  • 4
10

In v1.61 there is the ability to set the terminal names using variables. See 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}"
}

Variables available are:

${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.  

It looks like the ${task} variable is what you are looking for.

Mark
  • 143,421
  • 24
  • 428
  • 436
2

Sometimes, plugins will remove default keyboard shortcut bindings.

Look for "terminal.rename" in keyboard shortcuts then edit the keyboard shortcut to your preferred shortcut.

enter image description here

To apply your shortcut, make sure your cursor is focus in edit part of the window before you key in. Not at the terminal part.

Apit John Ismail
  • 2,047
  • 20
  • 19
1

In v1.41 there is a new command which can be used like so:

{
  "key": "ctrl+t",
  "command": "workbench.action.terminal.renameWithArg",
  "args": {
      "name": "remote"
  }
}

if you have some frequently used name, like "remote" or "build" that you use often.

Mark
  • 143,421
  • 24
  • 428
  • 436
0

With VSCode 1.63 (Nov. 2021), entering "<blank>" (ie., empty string) as name will restore the default name for that terminal.

See issue 134020

For instance:

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250