如何在ohmyposh中用python显示当前的虚拟环境?

2024-05-29 04:05:09 发布

您现在位置:Python中文网/ 问答频道 /正文

首先,我在《哦,我的时髦》中使用了hotstick.minimal主题。看起来是这样的enter image description here

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

enter image description here

我不想在左边显示venv的名称。我该怎么做

这是我的JSON文件:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "final_space": true,
  "osc99": true,
  "console_title": true,
  "console_title_style": "template",
  "console_title_template": "{{.Folder}}{{if .Root}} :: root{{end}} :: {{.Shell}}",
  "blocks": [

    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        { 
          "type": "root",
          "style": "plain",
          "foreground": "yellow",
          "properties": {
            "root_icon": ""
          }
        },
        {
          "type": "path",
          "style": "powerline",
          "foreground": "black",
          "background": "#68D6D6",
      "powerline_symbol": "",
          "leading_diamond": "",
          "trailing_diamond": "",
          "properties": {
        "prefix": " \uF07C ",
            "style": "folder"
          }
        },
        {
          "type": "python",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "#100e23",
          "background": "#906cff",
          "properties": {
            "prefix": " \uE235 "
          }
        },
        {
          "type": "git",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "black",
          "background": "green",
          "properties": {
            "display_stash_count": true,
            "display_upstream_icon": true,
            "display_status": true,
            "display_status_detail": true,
            "branch_icon": "  ",
            "branch_identical_icon": "≡",
            "branch_ahead_icon": "↑",
            "branch_behind_icon": "↓",
            "branch_gone": "≢",
            "local_working_icon": "",
            "local_staged_icon": "",
            "stash_count_icon": "",
            "commit_icon": "▷ ",
            "tag_icon": "▶ ",
            "rebase_icon": "Ɫ ",
            "cherry_pick_icon": "✓ ",
            "merge_icon": "◴ ",
            "no_commits_icon": "[no commits]",
            "status_separator_icon": " │",
            "status_colors_enabled": true,
            "color_background": true,
            "local_changes_color": "yellow"
          }
        }
      ]
    }
  ]
}

注意:由于字体原因,某些符号可能不会出现


Tags: branchtruetitlestyletypestatusdisplayroot

热门问题