oh-my-posh 模块在 git 目录中运行缓慢

问题描述 投票:0回答:1

我在 PowerShell 中使用 oh-my-posh,它在 git 存储库中速度非常慢。在常规目录中,如果我按 Enter 键,则会立即出现新行。但是,如果我在 git repos 中按 Enter 键,则需要 1-2 秒才能出现新行。这是我的个人资料:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#91ddff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "folder_icon": "",
            "folder_separator_icon": "  ",
            "home_icon": "",
            "style": "agnoster"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#95ffa4",
          "foreground": "#193549",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "git",
          "properties": {
            "display_status": true,
            "display_stash_count": true,
            "display_upstream_icon": true
          }
        },
        {
          "background": "#906cff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "prefix": "  "
          },
          "style": "powerline",
          "type": "python"
        },
        {
          "background": "#ff8080",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "exit"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true
}

我也尝试将

display_status
display_stash_count
display_upstream_icon
设置为 false,但这对性能几乎没有任何作用。有什么想法吗?

git oh-my-zsh
1个回答
0
投票

根据此链接,您应该在

"fetch_status": false
中附加
"properties"

          "properties": {
            "display_stash_count": true,
            "display_status": true,
            "display_upstream_icon": true,
            "fetch_status": false            // add this
          },

重新启动你的终端,你可以看到状态图标消失,性能得到改善。

之前:https://i.sstatic.net/TpOs3S0J.png

之后:https://i.sstatic.net/gzndKiIz.png

© www.soinside.com 2019 - 2024. All rights reserved.