8

I'm using the cmder (ConEmu) with Git Bash-tabs (MinGW) and I want to rename the current tab with a console command. Within a cmd-Tab I can use cmd /c RenameTab "myTabName" but I a need a similar command for the Git Bash.

The reason for this is as follows: besides for Git I'm using the Git Bash for connecting to several servers using the ssh-command, opening ssh connections to multiple servers on multiple tabs. To maintain an overview on which server I am in which tab I have to rename each tab manually using a shortcut for the rename tab function in the cmder. My ultimate goal would be to use a script which would open a ssh Connection with the command "ssh serverxyz" and also renames the current tab to "serverxyz" at the same time.

Thanks for any help.

2 Answers2

9

Use GuiMacro:

ConEmuC -GuiMacro Rename 0 "serverxyz"
Chad Nouis
  • 103
  • 3
Maximus
  • 20,637
  • 16
  • 91
  • 116
1
echo -ne '\e]0;title here\a'

Replace "title here" with what you want the title to be. That's arguably uglier than GuiMacro's solution but should work on more platforms too.

Edit: Maximus said this doesn't work but I use it in my scripts all the time. Turns out it only works in a script, as soon as the script is done executing ConEmu overwrites the title with the cwd.

Jay Paroline
  • 971
  • 6
  • 7
  • The question is about **Windows** platform and **mingw** started in **ConEmu** tab. That will not rename tab title. It may change only console title, but it may be immediately changed by `PS1`, `PROMPT_COMMAND` and others. – Maximus Oct 19 '14 at 08:45
  • @Maximus good point. I was always using this in the context of a script so it was working fine for my purposes, but you're right it doesn't seem to be a general solution. Updated my answer. – Jay Paroline Oct 20 '14 at 16:55
  • This works for me and I tested it under cygwin and msys2. I put it in `precmd()` – Bill Burdick May 09 '16 at 16:04