PowerShell和WSL for Ubuntu安装oh-my-posh

PowerShell

效果图:

1、字体安装:

可能出现乱码,字体安装推荐像Cascadia Code的字体,Caskaydia Cove Nerd Font | 下载

2、安装oh-my-posh

winget install oh-my-posh

3、配置主题,其中xxx.omp.json为你想要的主题名称,样式预览  oh-my-posh3主题预览 - 久漫 - 博客园 (cnblogs.com)  ,其中查看主题位置可以使用命令 $env:POSH_THEMES_PATH

notepad $PROFILE
#最后一行输入
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\paradox.omp.json" | Invoke-Expression

4、其中PowerShell文件图标需要额外的安装

Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module -Name Terminal-Icons
Get-ChildItem -Path . -Force ##查看效果

 每次重启PowerShell都要重新导入模块 Import-Module -Name Terminal-Icons,为了避免这种情况,在配置文件中加入即可,每次启动都会自动使用这个命令了。

notepad $PROFILE
#最后一行输入
Import-Module -Name Terminal-Icons

WSL for Ubuntu

效果图:

1、字体安装教程 :  ubuntu安装字体

2、安装oh-my-posh

 参考链接: Linux | Oh My Posh

sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh

3、载入them

mkdir ~/.poshthemes
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
chmod u+rw ~/.poshthemes/*.omp.*
rm ~/.poshthemes/themes.zip

主题可以直接在Themes | Oh My Posh 查看,找到喜欢的json名字,在~/.poshthemes下查看是否存在。

4、启用主题,xxx.omp.json为你想要的主题(如果要默认启动就在etc/profile最后一行加入这个)

eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/clean-detailed.omp.json)"

参考链接

Windows 终端自定义提示设置|微软文档 (microsoft.com)

Home | Oh My Posh

官方字体推荐:Oh My Posh被设计为使用Nerd Fonts。书字体是流行的字体,经过修补以包含图标。我们推荐 Meslo LGM NF ,但任何书字体都应该与标准 主题 兼容。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值