安装Oh My Posh 
可以先去Microsofe Store 安装winget,会比较方便
zsh
winget install JanDeDobbeleer.OhMyPosh安装完:
会在C:\Users\自己用户名\AppData\Local\Programs\oh-my-posh\themes>有很多主题
预览所有主题命令 
zsh
Get-PoshThemes
初始化并应用主题 
zsh
oh-my-posh --init --shell pwsh --config "自己的安装目录\oh-my-posh\themes\schema.json" | Invoke-Expression
#schema.json ---- 选择themes目录下的一款主题文件分隔符乱码问题 
但会发现分隔符会有乱码的问题
安装Nerd Fonts字体,在Terminal>Power Shell选择自己安装的字体,保存重启就生效啦。
PS:刚开始以为没有我常用的JetBrain Mono字体,就没在意这种解决方案,没想到里面字体挺丰富.
配置PowerShell 
因为应用的主题只在当前窗口有效果,所以需要配置每次PowerShell启动时都会执行应用主题的脚本
1.打开配置文件方式一 
- 获取到PowerShell配置文件绝对路径
zsh
$PROFILE
- 找到这个文件位置,打开并添加需要Power Shell启动时执行的脚本,保存文件重新打开Terminal看效果
zsh
oh-my-posh --init --shell pwsh --config "自己的安装目录\oh-my-posh\themes\schema.json" | Invoke-Expression2.打开配置文件方式二 
如果安装了VS Code,如下命令可以直接打开Power Shell配置文件
zsh
code $PROFILE自定义主题 
可借鉴的up主题文件:https://gitee.com/NilTor/public/blob/master/oh-my-posh-config.json
更多配置可查看官网配置文档
VS Code终端配置 
没有配置打开VS Code终端报错:
zsh
The term 'oh-my-posh' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify
     | that the path is correct and try again.- 在环境变量新增Oh My Posh路径下bin目录

- 在设置中配置配置自己安装的Nerd Font终端字体,(这里我填上我安装的是JetBrainsMono Nerd Font Mono)

隐藏提示语 
每次打开都会有这四句提示语,想要打开是干干净净的界面。

在PowerShell配置项中添加一个配置 ,配置参数 -NoLogo为隐藏提示语
json
{
  "commandline": "自己的pwsh.exe的路径 -NoLogo"
}完整配置参考
json
{
  "colorScheme": "Campbell",
  "font":
    {
      "face": "JetBrainsMono Nerd Font Mono"
    },
  "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
  "hidden": false,
  "name": "PowerShell",
  "source": "Windows.Terminal.PowershellCore",
  "commandline": "C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.2.2.0_x64__8wekyb3d8bbwe\\pwsh.exe -NoLogo",
  "startingDirectory": null
}