安装
-
在Microsoft Store中搜索oh my posh安装
-
安装MesloLGM NF字体
- https://github.com/ryanoasis/nerd-fonts/releases中选最新的Meslo.zip下载
- 完成后解压缩,全选,安装
-
修改终端字体配置
-
打开windows terminal
-
ctrl+shift+, 打开配置文件
在如下位置
"profiles": { "defaults": { # 可能有其他内容 } }
添加字体设置:
"profiles": { "defaults": { # 可能有其他内容 "font": { "face": "MesloLGM NF" } } }
-
-
修改主题配置
在powshell中输入如下内容:
# 如果之前没有配置文件,就新建一个 PowerShell 配置文件 if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } # 用记事本打开配置文件 notepad $PROFILE
在文档中添加
oh-my-posh init pwsh | Invoke-Expression
保存后就完成了
更换主题
参考官方文档:https://ohmyposh.dev/docs/installation/customize
# 这里介绍最简单的本地配置
# 下载主题
Get-PoshThemes
# 最下面会显示主题存储位置,例如C:\Users\xxxx\AppData\Local\Programs\oh-my-posh\themes
# 更换为本地主题
# 用记事本打开配置文件
notepad $PROFILE
选择你喜欢的主题,将文档内容修改为
oh-my-posh init pwsh --config 'C:\Users\xxxx\AppData\Local\Programs\oh-my-posh\themes\[主题名].omp.json' | Invoke-Expression
保存即可
给VScode的终端换主题
VScode的终端主题实际上和默认系统终端一致的,这里我们只需要更换字体即可
- 打开VScode,进入设置
- 搜索
Integrated:Font Family
- 改为
MesloLGM NF