Conemu: feature request: Change title to reflect the current directory

Created on 8 Mar 2018  ·  12Comments  ·  Source: Maximus5/ConEmu

if this is possible it will be very helpful for me. thanks

Most helpful comment

Well, if you read AnsiEscapeCodes.html, and according to RenameTab.cmd it seems that the following escape code can rename the tab:
%ESC%]9;3;"<new_title_str>"%ESC%\

You want to rename the tab to the current working directory, so instead of <new_title_str> we can use %CD% (cmd.exe's current working directory variable)

However, we want to echo this after each new command is executed, so we tie it to the %PROMPT% environment variable, and change %ESC% to $e and then change %CD% to $p (these are according to ConEmu and Windows cmd's documentation)

And then we can prepend the result like this:
prompt $E]9;3;"$P"$E\%prompt%

Now all you need to do is to run the above command _at each startup_ for which you may add it to the _end of_ the CmdInit.cmd file that ConEmu uses.

So you get this:

conemu-prompt-dir

(Notice that the diectory appears in the titlebar.)

All 12 comments

This should be possible

it's not possible. yes it should. or where? or what?

Well, if you read AnsiEscapeCodes.html, and according to RenameTab.cmd it seems that the following escape code can rename the tab:
%ESC%]9;3;"<new_title_str>"%ESC%\

You want to rename the tab to the current working directory, so instead of <new_title_str> we can use %CD% (cmd.exe's current working directory variable)

However, we want to echo this after each new command is executed, so we tie it to the %PROMPT% environment variable, and change %ESC% to $e and then change %CD% to $p (these are according to ConEmu and Windows cmd's documentation)

And then we can prepend the result like this:
prompt $E]9;3;"$P"$E\%prompt%

Now all you need to do is to run the above command _at each startup_ for which you may add it to the _end of_ the CmdInit.cmd file that ConEmu uses.

So you get this:

conemu-prompt-dir

(Notice that the diectory appears in the titlebar.)

thanks! i will try it! BTW some tools like https://github.com/sl5net/global-IntelliSense-everywhere read the window's title and change behavior (for example, IntelliSense, bash or similar) automatically depending on relavent mismatches that are obtained from the windows.

Interesting, thanks for introducing such tools to me!

seems i do something wrong?
2018-04-22 11_26_20-table awaiting action

Yep, you are using cmder )
It overwrites prompt via clink and this may break things.

? "cmder" ? i using ConEmu-Maximus5 is a Windows console emulator with tabs, which represents multiple consoles and simple GUI applications as one customizable GUI window with various features.

You may run any shell of your chose (Tasks are recommended) on ConEmu startup.

Far Manager (a console program for managing files and archives in Windows)gains a lot of improvements in ConEmu: Drag and Drop, Tabs for editors and so on.

© 2006-2008 Zoin (based on console emulator by SEt)
© 2009-2017 ConEmu.[email protected]

Online documentation: https://conemu.github.io/en/TableOfContents.html

You can show your appreciation and support future development by donating.
2018-04-22 14_31_48-table awaiting action

  1. Your cropped screenshot https://github.com/Maximus5/ConEmu/issues/1472#issuecomment-383367714 is definitely the cmder.
  2. 180206 is OldBuild.

@sl5net No, you're mistaken. Cmder is a terminal package created by using clink and extending ConEmu. While Cmder is built on ConEmu, you shouldn't ask @Maximus5 for help, because as he said, Clink changes how the prompt string is proccessed.

You have to actually consider the following issues:
1- Cmder actually sets /title Cmder in ConEmu, which is a fixed title, as explained in #1521 by @Maximus5.
2- Clink is a pre-processor for anything prompt related. The ESC ] 9 ; 3 ; ”txt“ ST escape sequence is ConEmu-specific OSC, Clink can't understand it, and to make this work it should pass the sequence, which it does not.

Even if you open ConEmu.exe from cmder\vendor\conemu-maximus5 directory, it runs the ConEmu with Cmder-specific designed configuration file, which should not be considered vanilla ConEmu.

You have two options now:

1- Download vanilla ConEmu from here without any additions (I've tested the sequence I gave you, and it works)
2- Open a new issue at Cmder, and ask @Maximus5 to implement something like #1521, while we at Cmder would work to make sure Clink doesn't break ConEmu-specific escape codes.

Hope this helps! :)

YES 😀 i changed noting into install configuration 😄 and works well ! what wonderful day !

and i addet
prompt $E]9;3;"$P"$E\%prompt%
end of the CmdInit.cmd .

and restarted codeEmu one time (you need to do this, open a nother tab only not worked). thats all. easy.

2018-04-22 17_57_18-h__download_conemupack 180416
2018-04-22 17_53_42-conemu 180418 installer

not works anymore.

for minutes i installed it by installer version ConEmuSetup.180506.exe

and i addet
prompt $E]9;3;"$P"$E%prompt%
end of the CmdInit.cmd .

and restarted codeEmu one time. ==> not working

Was this page helpful?
0 / 5 - 0 ratings