You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
visualize/tab-completion with forward slash as separator on Windows #2219
I'm beginning user in PSREadLine and would like to use more a Unix-like behavior inside PowerShell on Windows.
Two things come to my mind to extends PSReadLine:
Visualize slash as separator. For instance, I would like to configure PSReadLine to show the local directory indication as PS /Users/alan> instead of PS C:\Users\alan>
Enable tab-completion using forward slash. Today when using tab-completion the forward slash is converted to slash. For instance, ls /Users/ followed by tab is automatic converted to C:\Users
Alan Guedes (@alanlivio) Thanks for your comments. Those behavior are by design, when using PowerShell on Linux, PSReadLine will naturally use forward slash as the path separator.
Thank you Dongbo Wang (@daxian-dbw). I edited my comment to make clear that I was talking about running PowerShell on Windows.
Is there a way to enable that in PSReadLine on Windows?
changed the title [-]visualize/tab-completion with forward slash as separator[/-][+]visualize/tab-completion with forward slash as separator on Windows[/+]on Feb 15, 2021
well, no offense, but the design sucks
why not provide an option to let us decide ?
this feature is really one of the main reasons I hate using powershell
imagine you have a bash script and you want to execute it in wsl, and you are on windows
you start typing bash press_some_letters<press_tab> and you end up with a path thats not gonna work inside wsl :)
javad mnjd (@jd1378)Alan Guedes (@alanlivio) I looked into the code and there is no way, at least no simple way, to use unix-directory-separator in PSReadLine. There is a place that appends a directory separator, and that's patchable, but that only changes the last directory separator, not the preceding ones. The preceding separators are decided here:
CompleteInput is a PowerShell builtin method, unalterable. And the value it returns is of type CommandCompletion, which is readonly, so you can't even manually edit it after its creation. In other words, there is no simple way to patch PSReadLine so it uses unix directory separator in Windows.
Sorry for the late response. Nafid Enan (@3N4N) was right, the completion results for path are returned from the tab completion APIs in PowerShell engine, not generated by PSReadLine. So, the ask should better post in the PowerShell repo.
Activity
daxian-dbw commentedon Feb 15, 2021
Alan Guedes (@alanlivio) Thanks for your comments. Those behavior are by design, when using PowerShell on Linux, PSReadLine will naturally use forward slash as the path separator.
alanlivio commentedon Feb 15, 2021
Thank you Dongbo Wang (@daxian-dbw). I edited my comment to make clear that I was talking about running PowerShell on Windows.
Is there a way to enable that in PSReadLine on Windows?
[-]visualize/tab-completion with forward slash as separator[/-][+]visualize/tab-completion with forward slash as separator on Windows[/+]jd1378 commentedon Jan 23, 2023
well, no offense, but the design sucks
why not provide an option to let us decide ?
this feature is really one of the main reasons I hate using powershell
imagine you have a bash script and you want to execute it in wsl, and you are on windows
you start typing
bash press_some_letters<press_tab>and you end up with a path thats not gonna work inside wsl :)3N4N commentedon Jan 30, 2023
javad mnjd (@jd1378) Alan Guedes (@alanlivio) I looked into the code and there is no way, at least no simple way, to use unix-directory-separator in PSReadLine. There is a place that appends a directory separator, and that's patchable, but that only changes the last directory separator, not the preceding ones. The preceding separators are decided here:
PSReadLine/PSReadLine/Completion.cs
Line 291 in 9957183
CompleteInputis a PowerShell builtin method, unalterable. And the value it returns is of typeCommandCompletion, which is readonly, so you can't even manually edit it after its creation. In other words, there is no simple way to patch PSReadLine so it uses unix directory separator in Windows.Dongbo Wang (@daxian-dbw) could you care to verify my observations?
alanlivio commentedon Feb 3, 2023
Many thanks javad mnjd (@jd1378). It will be nice if Dongbo Wang (@daxian-dbw) can confirm if is possible.
daxian-dbw commentedon Feb 6, 2023
Sorry for the late response. Nafid Enan (@3N4N) was right, the completion results for path are returned from the tab completion APIs in PowerShell engine, not generated by PSReadLine. So, the ask should better post in the PowerShell repo.