Let’s get started and see how we can make our lives better with an awesome windows terminal. In today’s guide, I’ll show you how to install Oh-My-Posh for PowerShell with the Auto Suggestion module.
First, go to this link:
https://ohmyposh.dev/docs/installation/windows
Open Terminal. (Run as Administrator)
Then paste this line:
winget install JanDeDobbeleer.OhMyPosh -s winget
After installation, type in the terminal:
notepad $PROFILE
If this shows profile not found error, type this command:
New-Item -Path $PROFILE -Type File -Force
Then re-run this command again:
notepad $PROFILE
This will open Powershell profile in Notepad.
In opened notepad, paste these lines:
oh-my-posh init pwsh --config 'C:\Users\<username>\AppData\Local\Programs\oh-my-posh\themes\craver.omp.json' | Invoke-Expression
Replace with the username of your PC.
After this, restart the terminal. If shows any error, paste the line below:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Then restart the terminal again. This time, Oh my Posh will be loaded.
For autocomplete, we have to install a module.
Paste this line in the terminal:
Install-Module PSReadLine -Force
After installation is complete, go to the PowerShell config file again and paste these lines:
Import-Module PSReadLine
Set-PSReadLineOption -EditMode Windows
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -PredictionViewStyle InlineView
Save and restart the terminal again. Now autocomplete is also installed.
There might be some icons missing. For this, we have to install Nerd Fonts and set this in settings.
To install Nerd Font, go to this link:
https://www.nerdfonts.com/font-downloads
From there, I recommend installing the “CaskaydiaCove Nerd Font”.
Now go to Terminal settings -> appearance. Then in fonts settings, change the font to: “CaskaydiaCove Nerd Font“
Now, if you want the same terminal in VS Code, change the default terminal of VS Code to Powershell.
Then go to vs code settings.
Search for terminal font, then set the font to “CaskaydiaCove Nerd Font“
That’s it. Now enjoy the beauty of Terminal with the power of AutoComplete.