首先需要安装Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
安装Oh-my-posh,下面命令挨个执行:
choco install ConEmuInstall-Module posh-git -Scope CurrentUserInstall-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-gitImport-Module oh-my-poshSet-Theme tehrob
默认支持以下主题:
Name Type Location---- ---- --------Agnoster Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Agnoster.psm1Avit Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Avit.psm1Darkblood Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Darkblood.psm1Fish Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Fish.psm1Honukai Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Honukai.psm1Paradox Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Paradox.psm1Powerlevel10k-Classic Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Classic.psm1Powerlevel10k-Lean Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Lean.psm1PowerLine Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\PowerLine.psm1pure Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\pure.psm1robbyrussell Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\robbyrussell.psm1Sorin Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Sorin.psm1tehrob 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
