Install posh-git, oh-my-posh and CaskaydiaCode Nerd Font
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Visit https://www.nerdfonts.com/ and find CaskaydiaCove Nerd Font. The font contains glyphs/icons required by the themes.
Now open Powershell profile and configure it:
code $PROFILE
Paste the following:
# https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup
# https://ohmyposh.dev/docs/themes
# Install-Module posh-git -Scope CurrentUser
# Install-Module oh-my-posh -Scope CurrentUser
Import-Module posh-git
Import-Module oh-my-posh
# Themes require a font with glyphs (recommended Caskaydia Cove Nerd Font)
# Download fonts from https://www.nerdfonts.com/
# Install the theme once downloaded and set fontFace as such in Windows Terminal:
# {
# "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
# "hidden": false,
# "name": "PowerShell",
# "source": "Windows.Terminal.PowershellCore",
# "fontFace": "CaskaydiaCove Nerd Font"
# },
# Set the integrated terminal font in VSC and restart:
# {
# ...
# "terminal.integrated.fontFamily": "CaskaydiaCove Nerd Font"
# ...
# }
# Get-PoshThemes
Set-PoshPrompt -Theme aliens
# https://github.com/PowerShell/PSReadLine
Import-Module PSReadLine
# Shows navigable menu of all options when hitting Tab
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
# Autocompletion for Arrow keys
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
# Predictive suggestions based on history
Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -PredictionSource History
To list the available themes, run:
Get-PoshThemes
Navigate to ~\Documents\PowerShell\Modules\oh-my-posh\3.175.0\themes
copy, rename and modify the desired theme by removing the session
segment.
- https://github.com/PowerShell/PowerShell
- https://www.youtube.com/watch?v=I0iIZe0dUNw
- https://github.com/PowerShell/PSReadLine
- https://www.youtube.com/watch?v=lu__oGZVT98
- https://www.hanselman.com/blog/how-to-make-a-pretty-prompt-in-windows-terminal-with-powerline-nerd-fonts-cascadia-code-wsl-and-ohmyposh
- https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup
- https://zimmergren.net/making-windows-terminal-look-awesome-with-oh-my-posh/
- https://www.nerdfonts.com/
- https://stackoverflow.com/questions/60544366/how-to-remove-the-usernamehost-from-powershell-prompt