安装配置Oh My Posh

Tutorial: Set up a custom prompt for PowerShell or WSL with Oh My Posh

Install a Nerd Font

推荐Meslo Nerd Font

安装完成后打开Windows Terminal然后按"Ctrl+Shift+,(逗号)"来打开settings.json配置文件

"profiles": {
    "defaults": {
      "font": {
        "face": "MesloLGS NF"
      }
    },

Customize your PowerShell prompt with Oh My Posh

Install Oh My Posh for PowerShell

winget install oh-my-posh

This will install:

oh-my-posh.exe: The Windows executable
themes: The latest Oh My Posh themes

winget install XP8K0HKJFRXGCK

Choose and apply a PowerShell prompt theme

Choose a theme and update your PowerShell profile with this command. (You can replace notepad with the text editor of your choice.)

notepad $PROFILE

PS:The $PROFILE variable
Current User, Current Host - $PROFILE

$PROFILE | Get-Member -Type NoteProperty

it should be ""C:\Users{username}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1""

Add the following to the end of your PowerShell profile file to set the paradox theme. (Replace paradox with the theme of your choice.)

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

Use Terminal-Icons to add missing folder or file icons

To install Terminal-Icons with PowerShell, use the command:

Install-Module -Name Terminal-Icons -Repository PSGallery

参考

https://zhuanlan.zhihu.com/p/354603010
https://learn.microsoft.com/en-us/windows/terminal/tutorials/custom-prompt-setup
https://whoisryosuke.com/blog/2022/leveling-up-windows-powershell-with-oh-my-posh/

posted @   .net's  阅读(274)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示
主题色彩