-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Path translation in WSL and Git Bash #1772
Comments
I wonder if this would be implementable in a generic way such as by having two settings like this for Git bash:
|
The prefixes would have to be regular expressions to acount for the fact that C is not the only possible drive letter. Maybe something like: "pathConversionExpression": "|([A-Za-z])\(.*)|/mnt/\L$1/$2|" where $1, $2, ... are capture groups and \L is a lowercase operator (like in Notepad++). |
Yeah you're right, I guess full blown regex would be a better solution at that point. |
A better solution IMO would be to use the path conversion commands command built into WSL and Cygwin/MSYS2/Git Bash/etc. to convert it for us. So for WSL you would have: "pathConversionCmd": "wsl wslpath -a $1" And for Git Bash you could have : "pathConversionCmd": "\"C:\\Program Files\\Git\\usr\\bin\\cygpath.exe\" -a $1" |
Any traction on this issue? It seems small, but this is actually a major roadblock to me switching from cmder to Windows Terminal. |
I was looking into implementing this, I really like the idea but also I started thinking; |
You know what, we've got a team sync later today, I'll bring this up. We had a plan for WSL distros that would just work like magic, but that would not work at all for mingw profiles. Let's see if we can come up with something. I don't love the idea of putting an arbitrary exe into the settings file itself. It's definitely a possible security hole. We might be able to hack around this temporarily with
|
@zadjii-msft any update in that matter? |
My apologies. A bunch of the team was out sick last week, so we ended up just not having the meeting 😬 Hopefully everyone's feeling better this week (and we're not to preoccupied with last-minute //Build fires) |
notes from team sync: someone recalled vaguely that ConEmu has a solution for this that doesn't involve launching another exe to resolve that path. Maybe we should take a look at what they do, and see if that makes sense to emulate. |
Here's the documentation of Shell working dir in ConEmu for reference: https://conemu.github.io/en/ShellWorkDir.html I see Also tips for @Daniel599: Dustin no longer uses the account |
This is the only issue that blocks me to switch to Windows Terminal. Solution wise, I would suggest adding an option in the profile -> Advanced, the option can be called: "Convert Windows path to Linux path during paste" |
@lingyanmeng I would love to do that. How would we know to translate the path depending on WSL vs Cygwin vs msys? I was under the impression that windows-side paths were in different places for those various different linux-like installs. |
Any update on that issue? |
Nope. We'll make sure to update this thread when there is. In the meantime, might I recommend the Subscribe button?
|
Do you guys mind increasing the priority of this issue? It would be nice to be able to smoothly paste a file path. 😄 |
We certainly don't have the capacity to get to this ourselves any time soon, sorry 😕. If someone wants to help sort out the bits of this to enable this for WSL distros, I'd be more than capable to give pointers of where I'd start. The "use an exe to translate the path" seems a bit more... risqué, but the "I know the thing running in this terminal is this WSL so we can translate the path {like so}" seems pretty doable. |
Thank for for the quick reply! I don't plan on working on it at the moment. |
i'm pretty sure to have seen this at some point some time ago, i dragged a folder to terminal with ubuntu open on it, and it replaced the path to the corresponding |
This comment was marked as spam.
This comment was marked as spam.
#11625 detects whether the profile is WSL buy checking for Please, either
|
Because that setting literally tracks where the profile came from. There is no meaningful change you can make to it (and if you do, the profile will get deleted. Because the thing you said it "came from" can't attest that it came from there. That's actually how we automatically hide profiles for WSL distributions that you uninstall!) In general, detecting what a profile is running versus where a profile came from is difficult and annoying. Even these proposed solutions don't work for the case where you run Yes, path translations should be manually customizable. That's why this issue is still open, after all! I'd rather have some progress than no progress. |
Is it possible for the terminal to know what (sub)process it is currently hosting? |
To an extent, yes :) We have it on the books to track what we're hosting so that we can display better error messages and do profile matching. However, it'll break down for "opaque" remoting protocols like SSH and all of WSL (since processes on the Linux side don't present as processes on the Windows side) Still, that's better than nothing! |
Wouldn't it be enough to just introduce a separate |
At least enough for the terminal to know that it’s running something WSL! |
We already use VT to let shells announce their CWD, why not use VT to let shells announce what they actually are? |
This does not work in my case. I use WSL and Cygwin, which have different prefixes: WSL: /mnt |
Summary of the new feature/enhancement
It would be useful if the path pasted from clipboard to a shell was translated to a format that said shell understands if it differs form native windows format.
For example, if user pastes
C:\Windows\System\
to PowerShell or cmd it remains unchanged, but in WSL it changes to/mnt/c/Windows/System
and in Git Bash to/c/Windows/System
.The text was updated successfully, but these errors were encountered: