2021-04-16 15:44:50 +00:00
|
|
|
$global:IsOutputANSICompatible = (
|
2021-04-25 17:03:16 +00:00
|
|
|
$PSVersionTable.Platform -eq "Unix"
|
|
|
|
) -or (
|
2021-04-16 15:44:50 +00:00
|
|
|
([int]((Get-CimInstance -ClassName Win32_OperatingSystem).Version -split '\.')[0]) -ge 10
|
|
|
|
) -or (
|
|
|
|
($env:ConEmuANSI -eq 'ON') -and ($Host.Name -eq 'ConsoleHost' )
|
|
|
|
)
|
2021-04-27 16:04:12 +00:00
|
|
|
Get-Command -ListImported Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
|
2021-03-26 18:10:18 +00:00
|
|
|
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
|
2021-10-12 00:56:10 +00:00
|
|
|
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 ) {
|
2021-02-20 01:00:07 +00:00
|
|
|
$local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json"
|
2021-02-22 19:58:49 +00:00
|
|
|
if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" }
|
2021-02-20 01:00:07 +00:00
|
|
|
Set-PoshPrompt -Theme $poshPrompt
|
2021-04-27 16:04:12 +00:00
|
|
|
} elseif( Get-Command -ListImported Set-Theme -ErrorAction SilentlyContinue ) {
|
2021-04-16 15:44:50 +00:00
|
|
|
Set-Theme Paradox
|
|
|
|
} elseif( Get-Module -ListAvailable posh-git -ErrorAction SilentlyContinue ) {
|
|
|
|
Import-Module posh-git
|
|
|
|
|
|
|
|
$GitPromptSettings.AnsiConsole = $IsOutputANSICompatible
|
|
|
|
}
|