Windows Terminal 安装 Powerline 电力线

安装 oh-my-posh

打开 Windows PowerShell,输入以下命令:

winget install JanDeDobbeleer.OhMyPosh -s winget

更新 PowerShell 配置文件

新建或打开 PowerShell 配置文件:

notepad $PROFILE

将以下内容追加到配置文件的末尾,其中 paradox.omp.json 表示使用 paradox 主题:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\paradox.omp.json" | Invoke-Expression

允许系统运行 PowerShell 脚本

关闭 PowerShell 再次打开,看到系统默认不允许 ps1 脚本运行。

管理员方式打开 PowerShell,输入如下命令,再输入 y 允许:

Set-ExecutionPolicy RemoteSigned

重启 PowerShell 后看到 oh-my-posh 运行起来了:

安装 Nerd Fonts

切到 1_shell 主题:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\1_shell.omp.json" | Invoke-Expression

打开 Windows Terminal,可以看到部分图标显示不全,有些地方显示 ?。

需要安装一个 Nerd Fonts 才能显示完整,推荐 MesloLGM NF,使用管理员权限打开 Powershell,输入如下命令后选择 Meslo 回车安装:

oh-my-posh font install

打开 Windows Terminal,将 Windows Powershell 的字体改为 MesloLGMDZ NF 后保存即可看到效果。

修改主题

所有的主题保存在 oh-my-posh 安装目录下的 themes 文件夹下,例如 C:\Users\bayec\AppData\Local\Programs\oh-my-posh\themes

如果想使用 agnoster 主题,则把 $PROFILE 改成:

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\agnoster.omp.json" | Invoke-Expression

改完之后输入如下命令即可立刻生效:

. $PROFILE

所有主题

主题名称 是否单行 回车流畅 系统状态 命令耗时 git 状态[1]
1_shell ✔️
agnoster.minimal ✔️ ✔️
agnoster ✔️ ✔️
agnosterplus ✔️ ✔️
aliens ✔️ ✔️
amro ✔️
atomic ✔️ ✔️
atomicBit ✔️
avit ✔️
blueish ✔️
blue-owl ✔️ ✔️
bubbles ✔️
bubblesextra ✔️ ✔️
bubblesline ✔️ ✔️
capr4n ✔️ ✔️
cert ✔️ ✔️
cinnamon ✔️ ✔️
clean-detailed ✔️ ✔️ ✔️
cloud-native-azure ✔️ ✔️
cobalt2 ✔️ ✔️
craver ✔️
darkblood ✔️
default ✔️
devious-diamonds ✔️ ✔️
di4am0nd ✔️ ✔️ ✔️
dracula ✔️ ✔️
easy-term ✔️ ✔️ ✔️
emodipt ✔️ ✔️
emodipt-extend ✔️ ✔️ ✔️
festivetech ✔️
fish ✔️ ✔️
free-ukraine ✔️ ✔️ ✔️
glowsticks ✔️
gmay ✔️
grandpa-style ✔️ ✔️
gruvbox ✔️ ✔️ ✔️
half-life ✔️ ✔️
honukai ✔️
hotstick.minimal ✔️ ✔️
hunk ✔️ ✔️
huvix ✔️ ✔️
if_tea ✔️ ✔️ ✔️ ✔️
iterm2 ✔️
jandedobbeleer ✔️ ✔️ ✔️ ✔️
jblab_2021 ✔️ ✔️ ✔️
jonnychipz ✔️
jtracey93 ✔️ ✔️
jv_sitecorian ✔️ ✔️ ✔️
kali ✔️ ✔️
kushal ✔️ ✔️ ✔️
lambda ✔️ ✔️
lambdageneration ✔️ ✔️
larserikfinholt ✔️ ✔️ ✔️ ✔️
M365Princess ✔️ ✔️
marcduiker ✔️ ✔️ ✔️
markbull ✔️ ✔️ ✔️
material ✔️ ✔️
microverse-power ✔️
mojada ✔️ ✔️ ✔️ ✔️
montys ✔️ ✔️
mt ✔️ ✔️
multiverse-neon ✔️ ✔️
negligible ✔️
neko ✔️
night-owl ✔️ ✔️ ✔️ ✔️
nordtron ✔️
nu4a ✔️ ✔️
onehalf.minimal ✔️
paradox ✔️
pararussel ✔️
patriksvensson ✔️ ✔️
peru ✔️ ✔️ ✔️
pixelrobots ✔️ ✔️ ✔️
plague ✔️ ✔️
poshmon ✔️ ✔️
powerlevel10k_classic ✔️
powerlevel10k_lean ✔️ ✔️
powerlevel10k_modern ✔️
powerlevel10k_rainbow ✔️ ✔️
powerline ✔️ ✔️
probua.minimal ✔️
pure ✔️ ✔️
quick-term ✔️ ✔️ ✔️
remk ✔️ ✔️
robbyrussell ✔️ ✔️
rudolfs-dark ✔️ ✔️ ✔️
rudolfs-light ✔️ ✔️
sim-web ✔️
slim ✔️ ✔️
slimfat ✔️ ✔️
smoothie ✔️
sonicboom_dark ✔️ ✔️
sonicboom_light ✔️ ✔️
sorin ✔️ ✔️
space ✔️
spaceship ✔️
star ✔️
stelbent.minimal ✔️ ✔️
stelbent-compact.minimal ✔️ ✔️
takuya ✔️
thecyberden ✔️ ✔️
the-unnamed
tiwahu ✔️
tokyo ✔️ ✔️ ✔️ ✔️
tokyonight_storm ✔️
tonybaloney ✔️ ✔️
uew ✔️ ✔️
unicorn ✔️ ✔️ ✔️
velvet ✔️ ✔️ ✔️
wholespace ✔️ ✔️ ✔️ ✔️
wopian ✔️
xtoys ✔️ ✔️
ys ✔️
zash ✔️ ✔️
  1. 要求能完整显示 git 状态:包括本地未追踪文件、本地追踪文件改动、暂存区状态、待 push 状态、stash 状态。

Windows Terminal 安装 Powerline 电力线
https://leec.me/43abbdeb8601/
作者
Leec
发布于
2022年8月21日
更新于
2024年4月18日
许可协议