Switching to PowerLine + Additional minor changes

Styling will be based on PowerLine module.
Placed _ll command/alias correctly based on platform
This commit is contained in:
Gal Szkolnik 2021-10-11 20:56:10 -04:00
parent 79e85bb21d
commit 86c1189211
8 changed files with 48 additions and 6 deletions

1
base.linux/_ll.ps1 Normal file
View File

@ -0,0 +1 @@
_ls -la --color=auto $args

1
base.win/Aliases/_ll.ps1 Normal file
View File

@ -0,0 +1 @@
Get-ChildItem

View File

@ -41,4 +41,3 @@ if( $Package ) {
if( $NamesOnly ) { return $rVal } if( $NamesOnly ) { return $rVal }
return $rVal | ForEach-Object { Join-Path $MyPSScriptRoot "$_`.ps1" } return $rVal | ForEach-Object { Join-Path $MyPSScriptRoot "$_`.ps1" }

View File

@ -0,0 +1,35 @@
$local:MyPowerLineSetup = [ordered]@{
Title = { "Sz PS" }
SetCurrentDirectory = $true
PowerLineFont = $true
RestoreVirtualTerminal = $true
PowerLineCharacters = [ordered]@{
ColorSeparator = "$([char]::ConvertFromUtf32(0x2588)
)$([PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[-1]) "
ReverseColorSeparator = " $(
[PoshCode.Pansies.Entities]::ExtendedCharacters.ReverseColorSeparator.Trim()[0]
)$([char]::ConvertFromUtf32(0x2588))"
Separator = " $([PoshCode.Pansies.Entities]::ExtendedCharacters.Separator.Trim()[-1]) "
ReverseSeparator = " $(
[PoshCode.Pansies.Entities]::ExtendedCharacters.ReverseSeparator.Trim()[0]) "
}
Colors = @( [rgbcolor]"Grey18", [rgbcolor]"Grey65" ) #, [rgbcolor]"white", [rgbcolor]"red", [rgbcolor]"blue" )
Prompt = @(
{ "`n" } # A spaced line
{ New-PromptText -EBg VioletRed4 $MyInvocation.HistoryId }
{ Get-Elapsed -Trim }
{ Get-SegmentedPath -LengthLimit 30 }
{ $local:_git_prompt = Write-VcsStatus; if( $_git_prompt ) { "$([PoshCode.Pansies.Entities]::ExtendedCharacters.Branch)$_git_prompt" } }
# Right-align block
{ "`t" }
{ "$env:USERNAME @ $env:COMPUTERNAME" }
{ Get-Date -Format 'HH:mm:ss' }
{ Get-Date -Format 'MM/dd ddd' }
{ "$PSOSName " }
{ "`n" }
{ New-PromptText { "PS" } -Ebg Red }
)
}
Set-PowerLineTheme @MyPowerLineSetup

View File

@ -1 +0,0 @@
_ls -la --color=auto $args

View File

@ -3,7 +3,7 @@ class MyScript { #: System.Management.Automation.IValidateSetValuesGenerator {
$local:possibleValues = $( $local:possibleValues = $(
Get-MyPackages -ReturnFullPath -IncludeRoot -Force:$(-not $CurrentOnly) | Get-MyPackages -ReturnFullPath -IncludeRoot -Force:$(-not $CurrentOnly) |
Get-ChildItem -Recurse -Filter '*.ps1' | Get-ChildItem -Recurse -Filter '*.ps1' |
Select-Object -ExpandProperty FullName | ForEach-Object { Select-Object -Unique -ExpandProperty FullName | ForEach-Object {
$_ -replace '\.ps1$','' -replace "$($MyPSScriptRoot -replace '\\',"\\")[/\\]",'' $_ -replace '\.ps1$','' -replace "$($MyPSScriptRoot -replace '\\',"\\")[/\\]",''
} }
) )

View File

@ -7,7 +7,14 @@ $global:IsOutputANSICompatible = (
) )
Get-Command -ListImported Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue | Get-Command -ListImported Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete } ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
if( (Get-Command -ListImported Set-PoshPrompt -ErrorAction SilentlyContinue) -and $IsOutputANSICompatible ) { if( (Get-Command -ListImported Set-PowerLinePrompt -ErrorAction Ignore) ) {
$global:PSOSName = [SystemName]::_GetValidValues("",$true,$true) | Select-Object -First 1
if( Test-Path variable:global:GitPromptSettings ) {
$global:GitPromptSettings.TruncatedBranchSuffix = [char]0x2026
}
Set-PowerLinePrompt
} elseif( (Get-Command -ListImported Set-PoshPrompt -ErrorAction Ignore) -and $IsOutputANSICompatible ) {
$local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json" $local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json"
if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" } if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" }
Set-PoshPrompt -Theme $poshPrompt Set-PoshPrompt -Theme $poshPrompt

View File

@ -2,7 +2,7 @@
"Always": [ "Always": [
"psreadline", "psreadline",
"PowerShellCookbook", "PowerShellCookbook",
"oh-my-posh", "PowerLine",
"posh-git", "posh-git",
"z" "z"
]} ]}