标签: oh-my-posh

尝试安装 oh-my-posh 但它告诉我“该术语不被识别为...”

所以我尝试为 Windows 安装 oh-my-posh

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
Run Code Online (Sandbox Code Playgroud)

谁能帮我?

windows powershell oh-my-posh

13
推荐指数
1
解决办法
4万
查看次数

如何在Powershell控制台中删除环境前缀

有谁知道如何删除 Powershell 终端窗口中显示的 (venv) 前缀?我知道这纯粹是装饰性的,但我很想将其删除,因为我正在使用 Oh My Posh。

我已附上屏幕截图。在此输入图像描述

terminal powershell oh-my-posh

7
推荐指数
1
解决办法
1241
查看次数

如何让我的光标位于 OhMyPosh 主题的突出显示行之后的新行上?

我希望光标当前位于新行上,它与突出显示行位于同一行。我尝试过添加"newline" : true,但没有成功。我该如何解决它?

在此输入图像描述

terminal oh-my-posh

6
推荐指数
2
解决办法
2268
查看次数

如何在 oh-my-posh 中用 python 显示当前虚拟环境?

首先,我在 oh my posh 中使用 hotstick.minimal 主题。它看起来像这样。在此输入图像描述

\n

正如您所看到的,当前的 venv 看起来不太好。我对 JSON 文件做了一些更改。然后看起来像这样。

\n

在此输入图像描述

\n

我不想在左侧显示 venv 的名称。我怎样才能做到这一点?

\n

这是我的 JSON 文件:

\n
{\n  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",\n  "final_space": true,\n  "osc99": true,\n  "console_title": true,\n  "console_title_style": "template",\n  "console_title_template": "{{.Folder}}{{if .Root}} :: root{{end}} :: {{.Shell}}",\n  "blocks": [\n\n    {\n      "type": "prompt",\n      "alignment": "left",\n      "segments": [\n        { \n          "type": "root",\n          "style": "plain",\n          "foreground": "yellow",\n          "properties": {\n            "root_icon": "\xee\x82\xa2"\n          }\n        },\n        {\n          "type": "path",\n          "style": "powerline",\n          "foreground": "black",\n          "background": "#68D6D6",\n      "powerline_symbol": "\xee\x82\xb0",\n          "leading_diamond": "\xee\x82\xb0",\n          "trailing_diamond": "\xee\x82\xb0",\n          "properties": …
Run Code Online (Sandbox Code Playgroud)

python powershell virtualenv powerline oh-my-posh

6
推荐指数
1
解决办法
8649
查看次数

Windows 终端(哦,我的豪华)在我尝试过之后没有显示 git 状态

描述

  1. 我导入 posh-git 但不使用它的提示样式。我的 Windows 终端 $PROFILE 如下:

  2. 我读过类似的问题 [ Windows Terminal + oh-my-posh not shown git status并更改了主题文件,但它也不起作用。

    • 主题文件的“git”部分,例如:

      Import-Module posh-git
      Import-Module oh-my-posh
      Set-PoshPrompt -Theme default
      #$env:POSH_GIT_ENABLED = $true
      
      Run Code Online (Sandbox Code Playgroud)

      所有显示属性(“display_status”...)均为 true。

图像:

它不显示 git 状态!为什么?? 图片

问题

我只是想知道 oh-my-posh 是否已弃用 git 状态显示???

我已经阅读了oh-my-posh 博客页面,git 状态显示没有变化

windows-terminal oh-my-posh

6
推荐指数
1
解决办法
3484
查看次数

安装 posh-git 后图标未显示在 powershell 中

今天我在 PowerShell 中安装了 posh-git,但图标没有显示,而是显示一个内部带有问号的矩形框。以下是我遵循的步骤:

Install-Module oh-my-posh -Scope CurrentUser

然后

Install-Module posh-git -Scope CurrentUser

对于这两个包,我都选择了“Yes To All”选项。

安装软件包后,我打开 Microsoft.PowerShell_profile.ps1文件并添加以下代码片段:

Import-Module oh-my-posh
Import-Module posh-git

Set-PoshPrompt -Theme M365Princess
# M365Princess is the theme name I found from oh-my-posh doc
Run Code Online (Sandbox Code Playgroud)

settings.json之后我在 VS Code 中添加了这个"terminal.integrated.fontFamily": "Fira Code".

仅供参考,我已经安装了该Fira Code Medium Nerd Font Complete Windows Compatible字体。

然后通过VS Code重新启动。颜色显示完美,还有一些图标,但也有一些图标丢失,如下面的屏幕截图中的示例。

豪华 Git

请帮我解决这个问题。

windows powershell posh-git visual-studio-code oh-my-posh

5
推荐指数
1
解决办法
5029
查看次数

术语“oh-my-posh”未被识别为 cmdlet 的名称

我已将 oh-my-posh 配置为在 powershell 上工作,如果我从 Windows 终端运行 powershell,一切都会按预期工作(文档中清楚地说明了这一点)

\n

不过,我倾向于从 WSL 终端运行 powershell,因为我有这样的别名\n psl='/mnt/c/Program\\ Files/PowerShell/7/pwsh.exe'

\n

但现在当我运行该别名时出现以下错误

\n
oh-my-posh: C:\\Users\\username\\OneDrive\\Documents\\PowerShell\\Microsoft.PowerShell_profile.ps1:19\nLine |\n  19 |  oh-my-posh init pwsh --config 'C:\\Users\\username\\OneDrive\\Documents\\Powe \xe2\x80\xa6\n     |  ~~~~~~~~~~\n     | The term 'oh-my-posh' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the\n     | name, or if a path was included, verify that the path is correct and try again\n
Run Code Online (Sandbox Code Playgroud)\n

有什么想法吗?\n谢谢

\n

我尝试更改路径,但终端似乎无法识别 oh-my-posh

\n

powershell wsl-2 oh-my-posh

5
推荐指数
1
解决办法
2956
查看次数

Get-PSReadLineKeyHandler:找不到与参数名称“Key”匹配的参数。《Oh My Posh》中的这个是什么?

Get-PSReadLineKeyHandler : A parameter cannot be found that matches parameter name 'Key'.
At line:380 char:43
+             if ((Get-PSReadLineKeyHandler -Key Spacebar).Function -eq ...
+                                           ~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-PSReadLineKeyHandler], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.GetKeyHandlerCommand

Get-PSReadLineKeyHandler : A parameter cannot be found that matches parameter name 'Key'.
At line:383 char:43
+             if ((Get-PSReadLineKeyHandler -Key Enter).Function -eq 'O ...
+                                           ~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-PSReadLineKeyHandler], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.GetKeyHandlerCommand
Run Code Online (Sandbox Code Playgroud)

每当我打开 powershell 时都会出现此信息。我可以做什么来解决这个问题?

寻找解决方案。

powershell psreadline oh-my-posh

4
推荐指数
2
解决办法
7586
查看次数