Make your PowerShell fancy by Windows Terminal and Oh My Posh

Goals

Follow steps in this article, and the result will look like this

Steps

There are only 6 steps to do

  1. Install Windows Terminal
  2. Install posh-git and oh-my-posh
  3. Install powerline font
  4. Config powershell profile
  5. Config Windows Terminal Settings
  6. Config VSCode Settings

Maybe only need to takes 15 mins to set everything right.

Install Windows Terminal

From

Install posh-git and oh-my-posh

Open powershell and

1
2
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Install powerline font

See https://github.com/ryanoasis/nerd-fonts

Config powershell profile

Open powershell and

1
code $PROFILE

That will open Microsoft.PowerShell_profile.ps1, then we fill in this and save

1
2
3
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme paradox

Then powershell will import posh-git and oh-my-posh and set theme every time you start you powershell

Config Windows Terminal Settings

Open settings.json of Windows Terminal, add defaults section into profiles section, and assign colorScheme and fontFace you want

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
"profiles": {
"defaults":
{
// Put settings here that you want to apply to all profiles.
"colorScheme": "One Half Dark",
"fontFace": "SauceCodePro NF"
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "...",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "...",
"name": "命令提示字元",
"commandline": "cmd.exe",
"hidden": false
}
]
},
}

Config VSCode Settings

Open settings.json of vscode and add terminal.integrated.fontFamily

1
2
3
{
"terminal.integrated.fontFamily": "SauceCodePro NF"
}

References

作者

楊竑昕

發表於

2021-06-27

更新於

2023-04-03

許可協議

評論