DEV Community

Cover image for Install Powerline for Powershell
Anderson Gama
Anderson Gama

Posted on

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

Top comments (1)

Collapse
 
bergpb profile image
Lindemberg Barbosa

👏👏👏👏👏