Git Product home page Git Product logo

Comments (6)

Jaykul avatar Jaykul commented on June 12, 2024

Hey @mhartington sorry I didn't reply sooner (I really need to shorten the list of projects I get emails about to just mine, so I don't miss issues).

Yes, you can do that, but I hadn't built a slick function for it yet:

function Get-SegmentedPath { 
param($Length = 3)
    $dir = $pwd.Path;
    $buffer = @()
    while($dir) {
        $buffer += @{ Object = (Split-Path $dir -Leaf) }
        $dir = Split-Path $dir
        if(!($Length -= 1)) {
            $buffer += @{ Object = ""; }
            break
        }
    }
    [Array]::Reverse($buffer)
    $buffer
}

You need to define that, and add a call to that function into your PowerLinePrompt. I'd paste a screenshot, but I don't have a PowerLine font on this PC, so same-color separators look dumb 😊

I'm going to leave this open until I integrate that function to the module

from powerline.

Jaykul avatar Jaykul commented on June 12, 2024

Ok, I wrote a much better version of this in /Source/Public/Get-SegmentedPath.ps1

from powerline.

Thraka avatar Thraka commented on June 12, 2024

@Jaykul I'm having a hard time figuring out how to customize the > that gets placed with Get-SegmentedPath when it is in the $prompt variable. Is a setting somewhere?

from powerline.

Jaykul avatar Jaykul commented on June 12, 2024

@Thraka yes (you should have opened a new issue to ask this, though).

Yes, there is a ColorSeparator and a Separator (and reverse versions of each for right-aligned blocks). You can set them in a hashtable which currently lives as a static property. Type this to see the list, then set the one you want:

[PoshCode.Pansies.Entities]::ExtendedCharacters

That hashtable (and the one in [PoshCode.Pansies.Entities]::EscapeSequences) are saved when you Export-PowerLinePrompt and will be reloaded automatically when the module imports.

from powerline.

Thraka avatar Thraka commented on June 12, 2024

@Jaykul I know sorry i broke issue etiquette.. sorry :(

I think I found my fix. The problem is that ExtendedChars are characters, not strings. And the delimiter used throughout the scripts (the fancy >) burdens my eyes when they jam up close to other text, like in the directory path.

Playing around and learning how this all works, which has been hours of fun, (really it has, this is cool stuff) I figured out how to get what I want. In the $prompt array I'm adding spaces around the separator character to override segmentedpath's default.

{ New-PromptText { (Get-SegmentedPath -SegmentLimit 7) -join (" $([PoshCode.Pansies.Entities]::ExtendedCharacters["Separator"]) ") } -BackgroundColor DarkBlue -ForegroundColor White },

from powerline.

Jaykul avatar Jaykul commented on June 12, 2024

Well, all things considered ... I have no problem with the idea of getting rid of the character entities and making everything strings. Not a bad idea, really.

from powerline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.