Skip to content

Instantly share code, notes, and snippets.

@oleksis
Last active January 21, 2023 06:57
Show Gist options
  • Save oleksis/8a4f79f23dc9514e87fa252fefcee327 to your computer and use it in GitHub Desktop.
Save oleksis/8a4f79f23dc9514e87fa252fefcee327 to your computer and use it in GitHub Desktop.
Set up a custom prompt for PowerShell or WSL with Oh My Posh

Instalar y Configurar Oh-My-Posh V3 y Posh Git

Usar Powershell como Administrador o con las directiva de ejecución de PowerShell para ejecutar scripts

Establecer directiva de ejecución RemoteSigned

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Instalar

winget install JanDeDobbeleer.OhMyPosh
winget install -e --id Git.Git 
Install-Module -Name posh-git -Scope CurrentUser -Force

Descargar, descomprimir e instalar Fonts, FiraCode Nerd Font

Invoke-WebRequest -UseBasicParsing -Uri https://github.com/ryanoasis/nerd-fonts/releases/download/v2.3.1/FiraCode.zip -OutFile FiraCode.zip 
Expand-Archive .\FiraCode.zip

Importar Modulos en PowerShell

oh-my-posh init pwsh | Invoke-Expression
Import-Module posh-git

Listar y establecer Temas

Get-PoshThemes
Set-PoshPrompt -Theme microverse-power  # (deprecated)

Crear Profile permanentemente

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } 
notepad $PROFILE

COPY & PASTE

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\microverse-power.omp.json" | Invoke-Expression
Import-Module posh-git

Instalar en WSL

Install Git

sudo apt-get install git
sudo apt install unzip

Adicionar al .bashrc

# Oh My Posh
eval "$(oh-my-posh init bash --config ~/.poshthemes/microverse-power.omp.json)"

Instalar Meslo NerdFonts

mkdir -p ~/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.3.1/Meslo.zip -O ~/.local/share/fonts/Meslo.zip
unzip ~/.local/share/fonts/Meslo.zip -d ~/.local/share/fonts/NerdFonts
rm ~/.local/share/fonts/Meslo.zip

Recargar el profile para que los cambios tomen efecto

source ~/.bashrc

Extras

winget install -e --id Microsoft.PowerShell
winget install -e --id JanDeDobbeleer.OhMyPosh

Terminal Icons

Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module -Name Terminal-Icons

Instalar winget desde Microsoft Store

Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
$nid = (Get-Process AppInstaller).Id
Wait-Process -Id $nid
Write-Host Winget Installed

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment