-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Version Information
Cmder version:Full version 1.3.25.386
Operating system: Windows 11
Windows Terminal: 1.24.250825002-preview
Cmder Edition
Cmder Full (with Git)
Description of the issue
I have mostly successfully configured cmder to work within windows terminal. I set this up manually following the guide with a user install of windows terminal. I am not using the packaged windows term cmder version in the dev repo. The one thing that was annoying me was that I could not get it to duplicate the tab (using ctrl+shift+d) and keep the working directory like it does in non-cmder shells like cmd.
MS has this documentation informing that you must emit an OSC9;9 escape sequence with the directory. Following their instruction for cmd did not work though.
Today I realized that it is because clink is controlling the prompt so I toyed around with clink a little and eventually got it to work.
save a .lua script to the user config file with these contents:
local emit_directory_to_osc9 = clink.promptfilter(10)
function emit_directory_to_osc9:filter(prompt)
return "\x1b]9;9;"..os.getcwd().."\x1b\\"..prompt
end
After saving use ctrl+x, ctrl+r to reload clink or close and open the terminal.
This adds the escape sequence before the prompt with the working directory and enables windows terminal to duplicate and split the terminals while preserving the directory. This is all invisible so it does not modify the appearance of the terminal.
I would suggest something similar be added to the default clink configuration. I don't think there are any meaningful downsides but, admittedly, I don't have very thorough knowledge of cmder or clink.
For completeness, here is my windows terminal profile for cmder:
{
"commandline": "cmd.exe /k \"%cmder_root%\\vendor\\init.bat\"",
"guid": "{40b5c547-9df2-4bf6-9840-1331939523e9}",
"hidden": false,
"icon": "%cmder_root%\\icons\\cmder_green.ico",
"name": "cmder",
"startingDirectory": "~"
}
I mostly only use cmder with cmd, so I'm not sure if cmder+powershell or others need something similar to work in windows terminal also.
How to reproduce
- Open a cmder tab in windows terminal.
cd appdata
or some other directory.- ctrl+shift+D to duplicate tab.
- note that the new tab starts in the original directory.
Additional context
No response
Checklist
- I have read the documentation.
- I have searched for similar issues and found none that describe my issue.
- I have reproduced the issue on the latest version of Cmder.
- I am certain my issues are not related to ConEmu, Clink, or other third-party tools that Cmder uses.