Terminal: Feature Request: Path translation in WSL and Git Bash

Created on 2 Jul 2019  路  5Comments  路  Source: microsoft/terminal

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.

Area-Settings Issue-Feature Product-Terminal

Most helpful comment

Any traction on this issue? It seems small, but this is actually a major roadblock to me switching from cmder to Windows Terminal.

All 5 comments

I wonder if this would be implementable in a generic way such as by having two settings like this for Git bash:

"pathConversionForwardSlashes": true,
"pathConversionRemovePrefix": "C:\",
"pathConversionReplacePrefix": "/mnt/c/"

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dev-logan picture dev-logan  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

carlos-zamora picture carlos-zamora  路  3Comments

alabuzhev picture alabuzhev  路  3Comments

xmm1989218 picture xmm1989218  路  3Comments