安装PowerShell 7
下载地址: 官方GitHub
下载后安装即可
安装OhMyPosh
1
| winget install JanDeDobbeleer.OhMyPosh -s winget
|
配置OhMyPosh
下载主题
1 2 3 4 5 6 7 8 9 10
| Invoke-WebRequest -Uri "https://wget.la/https://github.com/JanDeDobbeleer/oh-my-posh/raw/main/themes/easy-term.omp.json" -OutFile "D:\[个人文件夹]\PowerShell 7\Themes\easy-term.omp.json"
Invoke-WebRequest -Uri "https://wget.la/https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/cert.omp.json" -OutFile "D:\[个人文件夹]\PowerShell 7\Themes\cert.omp.json"
Invoke-WebRequest -Uri "https://wget.la/https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/craver.omp.json" -OutFile "D:\[个人文件夹]\PowerShell 7\Themes\craver.omp.json"
Invoke-WebRequest -Uri "https://wget.la/https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/blueish.omp.json" -OutFile "D:\[个人文件夹]\PowerShell 7\Themes\blueish.omp.json"
Invoke-WebRequest -Uri "https://wget.la/https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/atomic.omp.json" -OutFile "D:\[个人文件夹]\PowerShell 7\Themes\atomic.omp.json"
|
下载字体
1 2 3 4
| oh-my-posh font install meslo
|
配置字体
打开终端(PowerShell 7): CTRL + SHIFT + , 打开配置文件, 主要替换defaults字段
1 2 3 4 5 6 7 8 9 10 11 12
| { "profiles": { "defaults": { "font": { "face": "MesloLGM Nerd Font" } } } }
|
配置主题
1 2 3 4 5 6 7 8
| notepad $PROFILE
New-Item -Path $PROFILE -Type File -Force
oh-my-posh get shell
|
在配置文件中加入
1
| oh-my-posh init pwsh --config "D:\[个人文件夹]\PowerShell 7\Themes\easy-term.omp.json" | Invoke-Expression
|
引用的主题就是前面下载的主题
重新打开一个PowerShell 7, 即可看到效果