首先需要安装Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
安装Oh-my-posh,下面命令挨个执行:
choco install ConEmu
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
关闭脚本禁用:允许Powershell运行脚本:
set-executionpolicy remotesigned
设置Profile脚本
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
打开生成的文件,加入下面代码:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme tehrob
默认支持以下主题:
Name Type Location
---- ---- --------
Agnoster Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Agnoster.psm1
Avit Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Avit.psm1
Darkblood Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Darkblood.psm1
Fish Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Fish.psm1
Honukai Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Honukai.psm1
Paradox Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Paradox.psm1
Powerlevel10k-Classic Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Classic.psm1
Powerlevel10k-Lean Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Lean.psm1
PowerLine Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\PowerLine.psm1
pure Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\pure.psm1
robbyrussell Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\robbyrussell.psm1
Sorin Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Sorin.psm1
tehrob Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\tehrob.psm1
设置为tehrob后:
quanzaiyu :: ~\Desktop\temp »
安装个性化字体,支持特殊符号:https://github.com/adam7/delugia-code/releases/download/v1910.04.1/Delugia.Nerd.Font.Complete.ttf