所以我试着在windows上安装
Install-Module oh-my-posh -Scope CurrentUser
打字
Get-PoshThemes
查看我下载的可用主题。但我收到了这条信息
Get-PoshThemes : The term 'Get-PoshThemes' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ Get-PoshThemes
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PoshThemes:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException有谁可以帮我?
发布于 2021-12-30 20:46:37
解决方案
(注:我运行的是PowerShell 7.1LTS)
首先,安装Nerd字体:
如果你已经跳过了
关于安装Nerd字体的说明:
https://learn.microsoft.com/en-us/windows/terminal/tutorials/custom-prompt-setup#install-a-nerd-font
然后,安装oh-my-posh
安装:posh-git oh-my-posh**:** :
# This first step isn't included in the Microsoft Docs page:
Install-Module posh-git -Scope CurrentUser
# ...though this one is:
Install-Module oh-my-posh -Scope CurrentUser2. ...follow剩下的说明如下:
3. ...finally,再次尝试命令:
# Set the prompt theme (defaults to 'agnoster' for me)
# ! Note: You have to do this step first (or it still won't work)
Set-PoshPrompt
# List the available themes (should work now)
# ! Note: this will attempt to render a bunch of graphics in your shell
Get-PoshThemes
# ! Note: use the -List option to avoid a bunch of graphics in your shell
# This will list the paths to the themes (in plaintext):
Get-PoshThemes -List可选
要避免手动输入Set-PoshPrompt,请在PowerShell $PROFILE中包含该命令
# ...e.g. to use the included 'zash' theme:
Set-PoshPrompt zash当您打开start shell实例(即新的...you选项卡或窗口)时,PowerShell应该会看到您的PowerShell提示更改。
结束语(边注)
在我开始工作之前,我最初遵循了下面的说明:
https://learn.microsoft.com/en-us/windows/terminal/tutorials/custom-prompt-setup#install-a-nerd-font
...no提到了posh-git模块或Set-PoshPrompt命令(截止到2021年12月30日)。
发布于 2022-04-13 20:22:09
我一直得到cmdlet,即使在遵循Robbie的指南之后也找不到错误。由于某些原因,新安装没有为我修复它,但更新程序修复了它:
Update-Module oh-my-poshhttps://stackoverflow.com/questions/70335044
复制相似问题