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
I do a fair amount of work across both Windows and WSL, the latter of which treats windows files as being hosted on mounted drives (C:/ becomes /mnt/c/). Since oh-my-posh only checks mappings once in full, creating consistent location mappings for both is extremely annoying.
When accessing windows files through WSL, I effectively have to duplicate each custom mapping with the first few characters tweaked slightly, as this short snippet of my config file demonstrates:1
Notice how even though the first mapping converts /mnt/c/ into C:/, the subsequent rules still need to explicitly spell out the mounted drive path at the start for it to work.
Feature Request
To solve this, I suggest adding an additional flag to change the behavior of having multiple mapped locations in the path segment2.
With the flag enabled, rather than checking each mapping individually one by one for a match, oh-my-posh would instead attempt to sequentially and recursively apply each mapping one by one in the listed order until all had been checked3.
The above config could therefore be replicated with only 3 mappings:
Bertie690
changed the title
Path Segment: Add support for sequential location mapping
Path Segment: Add support for recursive location mapping
Feb 15, 2025
Code of Conduct
What would you like to see changed?
Rationale
I do a fair amount of work across both Windows and WSL, the latter of which treats windows files as being hosted on mounted drives (
C:/
becomes/mnt/c/
). Since oh-my-posh only checks mappings once in full, creating consistent location mappings for both is extremely annoying.When accessing windows files through WSL, I effectively have to duplicate each custom mapping with the first few characters tweaked slightly, as this short snippet of my config file demonstrates:1
Notice how even though the first mapping converts
/mnt/c/
intoC:/
, the subsequent rules still need to explicitly spell out the mounted drive path at the start for it to work.Feature Request
To solve this, I suggest adding an additional flag to change the behavior of having multiple mapped locations in the path segment2.
With the flag enabled, rather than checking each mapping individually one by one for a match, oh-my-posh would instead attempt to sequentially and recursively apply each mapping one by one in the listed order until all had been checked3.
The above config could therefore be replicated with only 3 mappings:
Notes
This would likely require changing how oh-my-posh sorts mappings (perhaps disabling it if the flag is set).
Footnotes
Nerd font icons have been omitted for clarity. I do not actually spell out "documents-icon" in my path. ↩
To avoid breaking existing configs, this would naturally default to false. ↩
Similar to repeatedly calling
strings.Replace
. ↩The text was updated successfully, but these errors were encountered: