visualize/tab-completion with forward slash as separator on Windows
See original GitHub issueDescription of the new feature/enhancement
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 ofPS 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 toC:\Users
Thanks in advance for any feedback.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Windows forward slash and backslash characters as ...
Answer. The UNC syntax is sometimes written with forward slashes. In Windows the forward slashes and back slashes are equivalent, ...
Read more >When did Windows start accepting forward slash as a path ...
Using Windows 7 and Windows 10 an both accepting / as path separator using File Explorer (e.g. c:/ will automatically converted to c:\)....
Read more >Path.DirectorySeparatorChar Field (System.IO)
If you prefer to hard-code the directory separator character, you should use the forward slash ( / ) character. It is the only...
Read more >Why does the cmd.exe shell on Windows fail with paths ...
One can debate whether Windows CMD is "supposed" to support forward slashes. But that last result is a bug! Even if there is...
Read more >Why does Windows use backslashes for paths and Unix ...
The underlying Windows API can accept either the backslash or slash to separate directory and file components of a path, but the Microsoft...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jd1378 @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:
https://github.com/PowerShell/PSReadLine/blob/9957183ff2eb128a8f9df9e077c22acf21b72fdd/PSReadLine/Completion.cs#L291
CompleteInput
is 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.@daxian-dbw could you care to verify my observations?
Sorry for the late response. @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.