Chocolatey
提示
Chocolatey
不是 Windows
系统自带的,是自己安装的,请参考笔记:Chocolatey
$ choco install oh-my-posh $ refreshenv # 刷新环境变量点击复制复制失败已复制
注意
以管理员身份运行终端进行安装
安装日志
$ choco install oh-my-posh Chocolatey v0.10.15 Installing the following packages: oh-my-posh By installing you accept licenses for the packages. oh-my-posh v3.180.3 [Approved] oh-my-posh package files install completed. Performing other installation steps. The package oh-my-posh wants to run 'chocolateyinstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider: choco feature enable -n allowGlobalConfirmation Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y Downloading oh-my-posh 64 bit from 'https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v3.180.3/install.exe' Progress: 100% - Completed download of C:\Users\Iric\AppData\Local\Temp\chocolatey\oh-my-posh\3.180.3\install.exe (21.54 MB). Download of install.exe (21.54 MB) completed. Hashes match. Installing oh-my-posh... oh-my-posh has been installed. PROFILE: C:\Users\Iric\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 No Powershell profile was found. You may wish to create a profile and append 'Invoke-Expression (oh-my-posh --init --shell pwsh --config > "C:\Users\Iric\AppData\Local/Programs/oh-my-posh/themes/themename.omp.json")' to enable oh-my-posh. 'Get-PoshThemes' will list available themes for you oh-my-posh can be automatically uninstalled. Environment Vars (like PATH) have changed. Close/reopen your shell to see the changes (or in powershell/cmd.exe just type `refreshenv`). The install of oh-my-posh was successful. Software installed to 'C:\Users\Iric\AppData\Local\Programs\oh-my-posh\' Chocolatey installed 1/1 packages. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).点击复制复制失败已复制
重启!
PowerShell(推荐)
$ Install-Module oh-my-posh -Scope CurrentUser $ Install-Module posh-git -Scope CurrentUser # 官方没有指出,但是一般都要安装git集成点击复制复制失败已复制
查看可用主题
$ Get-PoshThemes or $ Get-PoshThemes -list点击复制复制失败已复制
更新
$ Update-Module oh-my-posh点击复制复制失败已复制
主题配置
输入如下两行命令,编辑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-PoshPrompt -Theme agnoster点击复制复制失败已复制
保存,并执行如下命令是配置生效:
$ . $PROFILE