Skip to content

Instantly share code, notes, and snippets.

@bgelens
Created November 3, 2017 20:04
Show Gist options
  • Save bgelens/f9aa8b376bee90e9f38a06f28e254319 to your computer and use it in GitHub Desktop.
Save bgelens/f9aa8b376bee90e9f38a06f28e254319 to your computer and use it in GitHub Desktop.
Set-PowerLinePrompt `
-SetCurrentDirectory `
-RestoreVirtualTerminal `
-PowerLineFont `
-FullColor `
-Title {
$title = "PowerShell {0} - {1} ({2}) - PID: {3}" -f $PSVersionTable.PSVersion.ToString(),(Convert-Path $pwd), $pwd.Provider.Name,$PID
if (Test-Elevation) {
"Elevated - $title"
} else {
$title
}
} `
-Prompt @(
{ "`t" },
{ New-PromptText { Get-Elapsed } -BackgroundColor DarkGray -ForegroundColor Black -ErrorForegroundColor White -ErrorBackgroundColor DarkRed },
{ New-PromptText { Get-Date -f "T" } -BackgroundColor Gray -ForegroundColor Black },
{ "`n" },
{ New-PromptText { $MyInvocation.HistoryId } -BackgroundColor Blue -ForegroundColor White },
{ New-PromptText { "$([PoshCode.Pansies.Entities]::ExtendedCharacters["Gear"])" * $NestedPromptLevel } -BackgroundColor Blue -ForegroundColor White }
{ if($pushd = (Get-Location -Stack).count) { New-PromptText { "$([char]187)" + $pushd } -BackgroundColor DarkGray -ForegroundColor White } }
{ New-PromptText { (Get-SegmentedPath) -join ([PoshCode.Pansies.Entities]::ExtendedCharacters["Separator"]) } -BackgroundColor DarkBlue -ForegroundColor White },
{
if ($null -ne (Write-GitStatusPowerLine)) {
New-PromptText { "$([PoshCode.Pansies.Entities]::ExtendedCharacters["Branch"]) $(Get-GitBranch)" } -BackgroundColor DarkGray -ForegroundColor White
}
}
)
Export-PowerLinePrompt
#requires -Module PowerLine,PSGit,Pansies
[PoshCode.Pansies.Entities]::ExtendedCharacters["Gear"] = ([char]0x263C)
@Jaykul
Copy link

Jaykul commented Nov 4, 2017

If you use -Save you can skip the Export.

And I thought the extended characters are included in the export, are they not re-importing right?

@bgelens
Copy link
Author

bgelens commented Nov 4, 2017

Yeah, I know about save 😄 Export was easier while experimenting to make sure it didn't overwrite all the time.
No the char was not saved to the config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment