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