Enchulame mi terminal de PowerShell

por | 24-abril-2023 | 0 Comentarios

Categoría(s): S.O.
Etiqueta(s): Terminal | Windows
Terminal Powershell evZek

Mejorar la apariencia de tu terminal de Power Shell utilizando Oh My Posh y fuentes de Nerd Fonts no solo la hace lucir más atractiva, sino que también puede mejorar tu experiencia en la terminal.

Al personalizar tu prompt con información relevante para ti, como la hora, la ruta de tu directorio actual, ms, el estado de tus repositorios de Git, etc. Puedes ahorrar tiempo y aumentar tu productividad en la terminal. Además, tener una terminal personalizada te permite trabajar con mayor comodidad y estilo.

Descarga tu fuente de Nerd Fonts

Ve a nerdfonts.com y descarga las fuentes que más te gusten. Asegúrate de instalar las que dicen “Complete Windows Compatible”.

NOTA: Recomiendo solo instalar las regulares ej. “Complete Windows Compatible Regular”.

  • Caskaydia Cove es la recomendada por Windows Terminal.
  • Meslo es la recomendada por Ho My Posh.

Actualizar Power Shell

Desde el sitio oficial de Microsoft Power Shell nos dicen como hacerlo.

Ejecutamos terminal como administrador y buscamos actualizaciones de Power Shell

# Buscar actualizaciones PowerShell
winget search Microsoft.PowerShell

# Comando para actualizar Power Shell
winget install –id Microsoft.Powershell –source winget

¿Cómo instalar Ho My Posh?

Con winget:

winget install JanDeDobbeleer.OhMyPosh -s winget
Con scoop:
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
Haciéndolo Manualmente:
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(‘https://ohmyposh.dev/install.ps1’))

Te recomiendo usar Chocolatey que es un gesto de paquetes.

# Instalar con Choco
choco install oh-my-posh -y

# Actualizar
choco upgrade oh-my-posh
# Desinstalar
choco uninstall oh-my-posh -y

Cambiemos la fuente de la terminal

  1. Clic derecho en la barra superior y “Configuración” o desplegamos el menú de la fecha hacia abajo y clic en “Configuración”.
  2. Selecciona “PowerShell” y dirígete a configuración adicional.
  3. Haz clic en “Apariencia” del lado derecho hasta abajo.
  4. En la sección “Tipo de Fuente”, selecciona la fuente que deseas utilizar.
  5. Si la fuente que deseas utilizar no se encuentra en la lista, haz clic en “Mostrar todas las fuentes” para ver una lista completa de fuentes disponibles en tu sistema.
  6. Una vez que hayas seleccionado la fuente deseada, clic en guardar.
Cambiar Fuente Powershell

Archivo de perfil de PowerShell

¿Cómo saber la ruta dónde debemos crearlo?
echo $PROFILE
Forzamos la creación del archivo.
New-Item -Force C:\Users\evzek\OneDrive\Documentos\PowerShell\Microsoft.PowerShell_profile.ps1
Buscamos ruta y creamos el Profile de Powershell

Abrimos nuestro archivo con cualquier editor, para poder agregar el comando de inicio de Ho My Posh:

oh-my-posh init pwsh | Invoke-Expression

¿Cómo cambiar de tema en Ho My Posh?

Revisar los temas disponibles.
Get-PoshThemes

Modificar Profile para seleccionar el tema.

oh-my-posh init pwsh –config “$env:POSH_THEMES_PATH/NOMBREDELTEMA.omp.json” | Invoke-Expression

Modificar Profile para seleccionar el tema localmente.

oh-my-posh init pwsh –config ‘C:/Users/Posh/NOMBREDELTEMA.omp.json’ | Invoke-Expression

Modificar Profile para seleccionar el tema remotamente.

oh-my-posh init pwsh –config ‘C:/Users/Posh/NOMBREDELTEMA.omp.json’ | Invoke-Expression

Mi terminal PowerShell personalizada

Ya saben que me gusta el morado.
Terminal Powershell evZek

schema.json

“$schema”: “https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json”,
“blocks”: [
{
“alignment”: “left”,
“newline”: true,
“segments”: [
{
“foreground”: “#bc93ff”,
“leading_diamond”: “<#04A0BD> \ue200 “,
“properties”: {
“display_host”: true
},
“style”: “diamond”,
“template”: “{{ .UserName }} <#545170>on“,
“type”: “session”
},
{
“foreground”: “#8A86AD”,
“properties”: {
“time_format”: “Monday <#545170>at 3:04 PM”
},
“style”: “diamond”,
“template”: ” {{ .CurrentDate | date .Format }} “,
“type”: “time”
},
{
“foreground”: “#ee79d1”,
“properties”: {
“branch_icon”: “\ue725 “,
“fetch_stash_count”: true,
“fetch_status”: true,
“fetch_upstream_icon”: true,
“fetch_worktree_count”: true
},
“style”: “diamond”,
“template”: ” {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \uf692 {{ .StashCount }}{{ end }} “,
“type”: “git”
}
],
“type”: “prompt”
},
{
“alignment”: “right”,
“segments”: [
{
“foreground”: “#a9ffb4”,
“style”: “plain”,
“type”: “text”
},
{
“foreground”: “#D5F1F1”,
“properties”: {
“style”: “dallas”,
“threshold”: 0
},
“style”: “diamond”,
“template”: ” {{ .FormattedMs }}s <#F1B2BE>\ue601“,
“type”: “executiontime”
},
{
“properties”: {
“root_icon”: “\uf292 ”
},
“style”: “diamond”,
“template”: ” \uf0e7 “,
“type”: “root”
},
{
“foreground”: “#D5F1F1”,
“style”: “diamond”,
“template”: ” <#CFE1B8>CPU:{{ round .PhysicalPercentUsed .Precision }}% “,
“type”: “sysinfo”
},
{
“foreground”: “#D5F1F1”,
“style”: “diamond”,
“template”: “<#F1B2BE>\uf6dc <#CFE1B8>RAM:{{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1000000000.0) }}/{{ (div .PhysicalTotalMemory 1000000000.0) }}GB “,
“type”: “sysinfo”
}
],
“type”: “prompt”
},
{
“alignment”: “left”,
“newline”: true,
“segments”: [
{
“foreground”: “#9779A8”,
“leading_diamond”: “<#00c7fc> \ue285 <#bc93ff>{“,
“properties”: {
“folder_icon”: “\uf07b”,
“folder_separator_icon”: “\uf9e0”,
“home_icon”: “home”,
“style”: “agnoster_full”
},
“style”: “diamond”,
“template”: ” \ue5ff {{ .Path }} “,
“trailing_diamond”: “<#bc93ff>}“,
“type”: “path”
},
{
“foreground”: “#A9FFB4”,
“foreground_templates”: [
“{{ if gt .Code 0 }}#ef5350{{ end }}”
],
“properties”: {
“always_enabled”: true
},
“style”: “plain”,
“template”: ” \ue286 “,
“type”: “exit”
}
],
“type”: “prompt”
}
],
“console_title_template”: “{{ .Folder }}”,
“transient_prompt”: {
“background”: “transparent”,
“foreground”: “#FEF5ED”,
“template”: “\ue285 ”
},
“version”: 2
}
Ya saben que me gusta el morado.

evZek Powershell

{
“name”: “evZek Powershell”,
“background”: “#261D45”,
“black”: “#0C0C0C”,
“blue”: “#57499D”,
“brightBlack”: “#00BABC”,
“brightBlue”: “#3B78FF”,
“brightCyan”: “#42BFB9”,
“brightGreen”: “#05FF8D”,
“brightPurple”: “#B4009E”,
“brightRed”: “#E74856”,
“brightWhite”: “#00E4FF”,
“brightYellow”: “#04FDFF”,
“cursorColor”: “#E4F77E”,
“cyan”: “#3A96DD”,
“foreground”: “#CCCCCC”,
“green”: “#13A10E”,
“purple”: “#881798”,
“red”: “#C50F1F”,
“selectionBackground”: “#FFF159”,
“white”: “#CCCCCC”,
“yellow”: “#C19C00”
}

Conclusión:

Si eres un usuario de Windows y utilizas la terminal de Power Shell con regularidad, Nerdfonts y Oh My Posh pueden ayudarte a mejorar significativamente su apariencia y funcionalidad.

0 comentarios

Enviar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *