Comments (6)
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.
Ok, I wrote a much better version of this in /Source/Public/Get-SegmentedPath.ps1
from powerline.
@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.
@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.
@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.
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)
- PowerLine fails to import saved prompt including a single-quoted string HOT 2
- Get-SegmentedPath variably handles alternative PSDrives with bugs
- Conditional block colors HOT 1
- Special characters is not shown in powershell. HOT 4
- List available blocks + how to add them.
- Run this every time ? HOT 2
- Install fails without -AllowClobber HOT 1
- Can't install with Pansies 1.4.0-beta03 HOT 1
- Error with separator HOT 1
- Support for no background colour HOT 4
- Loading profile info from Documents\WindowsPowerShell even when running on PSCore HOT 1
- Where is the prompt settings stored? HOT 4
- Doesn't work in Powershell Core HOT 3
- Needed to install prerelease Pansies HOT 4
- Error With New PowerShell 7.1 preview 2 - Get-Date Usage Needs Full Parameter Name HOT 2
- Exception in PowerLinePrompt HOT 7
- PowerLine 3.4.0 fails to read a config that worked with 3.3.0 HOT 8
- Req: A community theme repo HOT 2
- "Exception thrown from prompt block" even when the exception is handled within the block HOT 5
- What is the correct way to write a clear final separator?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerline.