Style update for Non-ANSI environments
This commit is contained in:
parent
1c4bf033fb
commit
b1f612828f
|
@ -1,7 +1,18 @@
|
||||||
|
$global:IsOutputANSICompatible = (
|
||||||
|
([int]((Get-CimInstance -ClassName Win32_OperatingSystem).Version -split '\.')[0]) -ge 10
|
||||||
|
) -or (
|
||||||
|
($env:ConEmuANSI -eq 'ON') -and ($Host.Name -eq 'ConsoleHost' )
|
||||||
|
)
|
||||||
Get-Command Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
|
Get-Command Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue |
|
||||||
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
|
ForEach-Object { Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete }
|
||||||
if( Get-Command Set-PoshPrompt -ErrorAction SilentlyContinue ) {
|
if( (Get-Command Set-PoshPrompt -ErrorAction SilentlyContinue) -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
|
||||||
} elseif( Get-Command Set-Theme -ErrorAction SilentlyContinue ) { Set-Theme Paradox }
|
} elseif( Get-Command Set-Theme -ErrorAction SilentlyContinue ) {
|
||||||
|
Set-Theme Paradox
|
||||||
|
} elseif( Get-Module -ListAvailable posh-git -ErrorAction SilentlyContinue ) {
|
||||||
|
Import-Module posh-git
|
||||||
|
|
||||||
|
$GitPromptSettings.AnsiConsole = $IsOutputANSICompatible
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue