Install Powerline for Powershell

smashse

Anderson Gama

Posted on May 16, 2021

Install Powerline for Powershell

I always used Powerline in Linux but I didn't know it had an option for Windows, very nice :-)

Powerline provides a customized command prompt experience providing Git status color-coding and prompts.

Set execution policy

Get-ExecutionPolicy -List
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine
Enter fullscreen mode Exit fullscreen mode

Install Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Enter fullscreen mode Exit fullscreen mode

Install Git on Windows

choco install git wget unzip code
Enter fullscreen mode Exit fullscreen mode

Install Powerline in PowerShell

Using PowerShell, install Posh-Git and Oh-My-Posh:

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Enter fullscreen mode Exit fullscreen mode

If you are using PowerShell Core, install PSReadline:

Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck
Enter fullscreen mode Exit fullscreen mode

In your PowerShell profile, add the following to the end of the file and Customize your PowerShell prompt:

echo 'Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme paradox' > $PROFILE
Enter fullscreen mode Exit fullscreen mode

List of themes: https://ohmyposh.dev/docs/themes/

Powerline fonts: https://github.com/powerline/fonts

cd ${HOME}\Downloads\
wget -c https://github.com/powerline/fonts/archive/refs/heads/master.zip
unzip .\master.zip
Set-ExecutionPolicy Bypass -Scope Process -Force; powershell ${HOME}\Downloads\fonts-master\install.ps1
Enter fullscreen mode Exit fullscreen mode

Set Ubuntu Mono derivative Powerline as your font:

{
    "colorScheme": "Solarized Dark",
    "commandline": "powershell.exe",
    "fontFace": "Ubuntu Mono derivative Powerline",
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "hidden": false,
    "name": "Windows PowerShell"
},
Enter fullscreen mode Exit fullscreen mode

Source:
https://github.com/powerline/powerline

https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup

💖 💪 🙅 🚩
smashse
Anderson Gama

Posted on May 16, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related