Jaykul / PowerLine

A more PowerShell prompt
MIT License
567 stars 31 forks source link

Enh request - function to get ~ relative path #2

Closed rkeithhill closed 7 years ago

rkeithhill commented 8 years ago

When I'm in my home dir I want my paths to be shortened e.g.:

~\Documents\WindowsPowerShell

I could see a number of Path oriented commands like this including collapsing paths to a form like C:\Git\...\src\PowerShellEditorServices.Protocol\DebugAdapter to make a path fit within a certain number of characters.

Jaykul commented 8 years ago

Yeah, can you prototype something to do that @rkeithhill?

I once thought about using "~" and any defined PSDrives ... and testing to see if $pwd starts with their root paths, and then replacing the string with that. Obviously as you've seen, I just settled for one folder name (because I use ZLocation, the folder name is the important thing), and putting the whole path in my title (or in my status bar, thank you conemu).

rkeithhill commented 8 years ago

In fact, I do have a prototype. Let me submit it as a PR tonight. It "might" be a good starting point so I won't hold it against you if you reject the PR. But it's a start. :-)

gravejester commented 7 years ago

Did anything come of this @rkeithhill ? If not, I think I have a path-shortener function that could be used for this.

rkeithhill commented 7 years ago

Yes, see #7

gravejester commented 7 years ago

Ah, I didn't look good enough then. Thanks. Oh well, I at least got inspired to add some more functionality to my function :)

Jaykul commented 7 years ago

There are two versions of this in the 2.3 release.