Fork me on GitHub

terminal 终端美化

编辑 PowerShell 配置文件脚本,每次启动之后自动加载

notepad $PROFILE

在配置文件里添加以下行:

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

重新加载配置文件以使更改生效

. $PROFILE

查看所有themes:

Get-PohshThemes

设置选中的themes:

oh-my-posh init pwsh --config 'C:\Users\Lenovo\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json' | Invoke-Expression

设置随机themes:

$theme = Get-ChildItem $env:UserProfile\\AppData\\Local\\Programs\\oh-my-posh\\themes\\ | Get-Random
echo "hello! today's lucky theme is: $theme :)"
oh-my-posh --init --shell pwsh --config $theme.FullName | Invoke-Expression

参考链接:
Themes | Oh My Posh
PowerShell | Oh-My-Posh|
ubuntu 安装看这个 | oh-my-posh

posted @ 2023-01-09 10:38  Cloudhan  阅读(57)  评论(0编辑  收藏  举报