Instalar oh my posh para mejorar powershell en windows

Paso 1: Instalar PSReadLine

Install-Module PSReadLine -Scope CurrentUser

Paso 2: Instalar Terminal-Icons

Install-Module -Name Terminal-Icons -Repository PSGallery -Scope CurrentUser

Paso 3: Instalar Oh My Posh

Install-Module oh-my-posh -Scope CurrentUser

Paso 4: Instalar una fuente

Descarga e instala la fuente recomendada, Cascadia Code PL, desde el sitio web de Microsoft. o desde esta web https://www.nerdfonts.com/font-downloads

Paso 5: Configurar Oh My Posh

Abre tu perfil de PowerShell con notepad $PROFILE y agrega estas líneas al final:

oh-my-posh --init --shell pwsh --config C:/Users/User/Dropbox/Computer/AppData/powershell.json | Invoke-Expression

if ($host.Name -eq 'ConsoleHost' -or $host.Name -eq 'Visual Studio Code Host' ) {

  Import-Module PSReadline -RequiredVersion 2.2.6
  Set-PSReadLineOption -EditMode Windows
  Set-PSReadLineOption -PredictionSource History

  Set-PSReadlineOption -Color @{
    "Command"          = [ConsoleColor]::Green
    "Parameter"        = [ConsoleColor]::Gray
    "Operator"         = [ConsoleColor]::Magenta
    "Variable"         = [ConsoleColor]::Yellow
    "String"           = [ConsoleColor]::Yellow
    "Number"           = [ConsoleColor]::Yellow
    "Type"             = [ConsoleColor]::Cyan
    "Comment"          = [ConsoleColor]::DarkCyan
    "InlinePrediction" = '#70A99F'
  }

  Set-PSReadLineKeyHandler -Function AcceptSuggestion -Key 'Ctrl+Spacebar'
  Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
  Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward 

  Set-PSReadLineKeyHandler -Key Ctrl+Shift+b `
                       -BriefDescription BuildCurrentDirectory `
                       -LongDescription "Build the current directory" `
                       -ScriptBlock {
    [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
    [Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet build")
    [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
  }
}

Import-Module -Name Terminal-Icons

El resultado son iconos, la barra de direcciones reducida y autocomplete de comandos.

powershell configurado con oh my posh