PowerShell_Scripts/base/profile.d/Style.ps1

21 lines
989 B
PowerShell
Raw Normal View History

2021-04-16 15:44:50 +00:00
$global:IsOutputANSICompatible = (
$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' )
)
Get-Command -ListImported Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
if( (Get-Command -ListImported Set-PoshPrompt -ErrorAction SilentlyContinue) -and $IsOutputANSICompatible ) {
$local:poshPrompt = Join-Path $HOME ".oh-my-posh.omp.json"
if( -not (Test-Path $poshPrompt) ) { $poshPrompt = "slim" }
Set-PoshPrompt -Theme $poshPrompt
} 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
}