-
解除禁止腳本
Set-ExecutionPolicy RemoteSigned
-
下載Oh My Posh
winget install oh-my-posh
或者
Install-Module oh-my-posh -Scope AllUsers
-
下載Git提示
Install-Module posh-git -Scope CurrentUser
或者
Install-Module posh-git -Scope AllUser
-
下載命令提示
Install-Module PSReadLine -RequiredVersion 2.1.0
-
添加配置
notepad $profile
添加以下配置
Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadLineKeyHandler -Chord "Ctrl+RightArrow" -Function ForwardWord Import-Module posh-git oh-my-posh init pwsh --config D:\ProgramData\PowerShellTheme\onehalf.minimal.omp.json | Invoke-Expression
注意: D:\ProgramData\PowerShellTheme\onehalf.minimal.omp.json為添加主題JSON文件本地路勁(主題列表:Themes | Oh My Posh),可以在主題列表里面選擇自己喜歡的
-
添加font,(可選,這是設置自己字體類型)
-
設置font
-
oh-my-posh報錯重啟電腦(注意C盤用戶名為中文)
-
配置流程出現問題
可能原因:oh-my-posh不再維護windows shell版本,官網:https://ohmyposh.dev/docs/
Installation→Windows→manual,復制指令進終端:
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))