DEV Community

Ewerton Jordão
Ewerton Jordão

Posted on • Originally published at Medium on

5 4

PowerShell Core | Terminal-Icons + Nerd Fonts

Tips | Customizando o seu terminal PS

E ae, pessoal, beleza? Falando hoje sobre um pacote bem legal desenvolvido por Brandon Olin. O Terminal-Icons proporciona uma interface amigável que no terminal não é padrão deste tipo de aplicação.

Esse projeto é bem legal pra dar um pouco mais de visibilidade para os arquivos quando estamos no modo terminal, ele utiliza o projeto NERD FONTS.

No link abaixo temos um passo a passo para que a fonte seja reconhecida e funcione no nosso terminal.

How to get @DevBlackOps Terminal-Icons module working in PowerShell on Windows

Note: since version 0.1.1 of the module this now works in Windows PowerShell or PowerShell Core.

  1. Download and install this version of Literation Mono Nerd Font which has been specifically fixed to be recognised as monospace on Windows:

https://github.com/haasosaurus/nerd-fonts/blob/regen-mono-font-fix/patched-fonts/LiberationMono/complete/Literation%20Mono%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf

(see this issue for more info: ryanoasis/nerd-fonts#269)

  1. Modify the registry to add this to the list of fonts for terminal apps (cmd, powershell etc.):
$key = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont'
Set-ItemProperty -Path $key -Name '000' -Value 'LiberationMono NF'
  1. Open PowerShell, right click the title bar > properties > Font > select your new font from the list.

  2. Install and load Terminal-Icons:

Install-Module Terminal-Icons -Scope CurrentUser
Import-Module Terminal-Icons

Result:

image

Ajuste da fonte, botão direito na barra

Obs: se você utiliza o terminal integrado do Visual Studio code a fonte não é reconhecida infelizmente 😫, porém abrindo o terminal é sucesso 😍 tudo funciona perfeitamente utilizando a fonte correta 😄.

Para teste criei alguns arquivos vazios, segue abaixo o script que utilizei para criar a massa de arquivos:

$ListaExtensoes = (".sql",".js",".css",".html",".cs",".cpp",".java",".go",".py",".php",".r",".ps1")
New-Item -Path $home\desktop -Name "terminal-icon" -ItemType Directory -Force
foreach($file in $ListaExtensoes){
New-Item -Path "$home\desktop\terminal-icon" -Name "teste-teminalicon$file" -Value $null -ItemType File -Force
}
Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module -Name Terminal-Icons

➕ Demo CentOS:

Fiz o download da mesma fonte LiberationMono após a instalação alterei no meu terminal para utiliza-la e a mágica acontece 🎉.

Exemplo CentOS

É isso pessoal, não se esqueça, PS é vida ❤️

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (2)

Collapse
 
juan20 profile image
Juan Andrade

Ótimo post me ajudou muito, consegui configurar no vscode colocando nas configurações do usuário para colocar a fonte no terminal com: "terminal.integrated.fontFamily": "'LiterationMono NF'",

Collapse
 
anderssonpeter profile image
Peter

You should give PowerType a try it gives you suggestions for common tools like git and non.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs