powershell oh-my-posh配置
字体下载
进入官网找到fonts的界面后发现,“Oh My Posh was designed to use Nerd Fonts.”,所以这里我们采用官网给出的推荐字体 Meslo LGM NF,点击下载后安装即可;
下载后解压缩,选择喜欢的字体安装,安装完成后在Windows Terminal中选用该字体;
安装oh-my-posh
进入官网找到Get Started界面,可以看到有三种安装方式,这里我们采用winget方式(安装过程可能需要把杀毒软件给关闭):
winget upgrade oh-my-posh
安装完成之后进入C:\Users\UserName\AppData\Local\Programs\oh-my-posh后会发现下载好了所有所需的theme文件;
需要强调一点的是:网上绝大多数推荐 powershell 的安装方法类似于直接使用了底层的 PowerShell 命令,安装了一个 powershell module,并在每次启动 PowerShell 的时候导入该模块;所以我们在这里采用winget方式;
选择自己喜欢的一个powershell主题,然后在powershell中输入:
notepad $PROFILE
复制:
oh-my-posh init pwsh --config C:\Users\UserName\AppData\Local\Programs\oh-my-posh\themes\paradox.omp.json | Invoke-Expression
然后在powershell中输入:
. $PROFILE
即可;
我们还可以运行来查看所有的主题,从中选择我们喜欢的;
Get-PoshThemes