Skip to content

Instantly share code, notes, and snippets.

@ermogenes
Last active May 2, 2023 11:05
Show Gist options
  • Save ermogenes/106c79087327feda8227b79a7c284512 to your computer and use it in GitHub Desktop.
Save ermogenes/106c79087327feda8227b79a7c284512 to your computer and use it in GitHub Desktop.

Configurando aparência de estação de trabalho

image

Habilitando Unicode

Para mudar essa configuração globalmente, faça (usando um usuário com permissões de administrador):

  • execute intl.cpl para abrir a configuração de Região;
  • mude para a aba 'Administrativo';
  • clique em 'Alterar localidade do sistema';
  • ative 'Usar Unicode UTF-8 para suporte de linguagem mundial';
  • reinicie o computador.

Se preferir, pode fazer isso em linha de comando abrindo um Powershell com privilégios de administrador e executar:

'ACP', 'OEMCP', 'MACCP' | Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Nls\CodePage -Name { $_ } 65001

Fontes

Escolha uma fonte em Nerd Fonts. Baixe e instale.

Nem perca seu tempo tentando fazer funcionar no cmd.exe/conhost. Instale o Windows Terminal pela loja do Windows.

No Windows Terminal configure a fonte instalada em Padrões > Aparência > Tipo de Fonte. Escolha a fonte baixada em sua versão ... Nerd Font .... Se desejar, ative também a configuração Efeito de terminal retrô.

Adicionar ao arquivo $PROFILE do Powershell:

[console]::InputEncoding = [console]::OutputEncoding = [System.Text.UTF8Encoding]::new()

Prompt customizado

Usaremos o Oh My Posh.

Abra o Powershell.

Instalação:

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))

Liberação em antivírus:

(Get-Command oh-my-posh).Source

Para testar todos os temas instalados, use:

Get-PoshThemes

Adicionar ao arquivo $PROFILE:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/bubbles.omp.json" | Invoke-Expression

Substituir bubbles pelo nome do tema desejado.

Instalar pacote de ícones adicional:

Install-Module -Name Terminal-Icons -Repository PSGallery

Adicionar ao arquivo $PROFILE:

Import-Module Terminal-Icons

Para testar os ícones:

Show-TerminalIconsTheme

Para atualizar:

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))

Ref.: https://docs.microsoft.com/pt-br/windows/terminal/tutorials/custom-prompt-setup

WSL

Download do Oh My Posh e dos temas:

sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh
mkdir ~/.poshthemes
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
chmod u+rw ~/.poshthemes/*.omp.*
rm ~/.poshthemes/themes.zip

Instalação de fontes:

oh-my-posh font install

Configurar auto-inicialização em ~/.bashrc:

eval "$(oh-my-posh init bash --config ~/.poshthemes/blue-owl.omp.json)"

Se preferir, aponte para os temas no Windows.

eval "$(oh-my-posh init bash --config /mnt/c/Users/SEU-USUARIO/AppData/Local/Programs/oh-my-posh/themes/blue-owl.omp.json)"

VsCode

Exemplo com a fonte FiraCode Nerd Font Mono.

Em settings.json:

{
	"editor.fontFamily": "FiraCode Nerd Font Mono",
	"editor.fontLigatures": true,
	"terminal.integrated.fontFamily": "FiraCode Nerd Font Mono"
}
@ermogenes
Copy link
Author

Configurações do Powershell para histórico:

Tab estilo bash:

Set-PSReadlineKeyHandler -Key Tab -Function Complete

ou

Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

Autocompletar usando o histórico:

Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

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