JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.55k stars 2.4k forks source link

Oh-my-posh newline not working as intended. #5874

Closed NucleoFusion closed 2 weeks ago

NucleoFusion commented 2 weeks ago

Code of Conduct

What happened?

I copy pasted the catppuccin-frappe file in my config and was making some changes, which was to have the prompt on a newline, but it doesnt work as intended, i want the '>' to come on the newline

2024-11-12_11-44

Theme

catppuccin-frappe + my own config

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "palette": {
    "os": "#ACB0BE",
    "closer": "p:os",
    "pink": "#F4B8E4",
    "lavender": "#BABBF1",
    "blue": "#8CAAEE"
  },
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "foreground": "p:os",
          "style": "plain",
          "template": "{{.Icon}} ",
          "type": "os"
        },
        {
          "foreground": "p:blue",
          "style": "plain",
          "template": "{{ .UserName }} ",
          "type": "session"
        },
        {
          "foreground": "p:lavender",
          "properties": {
            "folder_icon": "..\ue5fe..",
            "home_icon": "~",
            "style": "folder"
          },
          "style": "plain",
          "template": "{{ .Path }} ",
          "type": "path"
        },
        {
          "foreground": "p:blue",
          "properties": {
            "branch_icon": "\ue725 ",
            "cherry_pick_icon": "\ue29b ",
            "commit_icon": "\uf417 ",
            "fetch_status": false,
            "fetch_upstream_icon": false,
            "merge_icon": "\ue727 ",
            "no_commits_icon": "\uf0c3 ",
            "rebase_icon": "\ue728 ",
            "revert_icon": "\uf0e2 ",
            "tag_icon": "\uf412 "
          },
          "template": "{{ .HEAD }} ",
          "style": "plain",
          "type": "git"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "type": "prompt",
      "segments": [
        {
          "type": "text",
          "newline": true,
          "style": "plain",
          "template": " "
        }
      ]
    },
    {
      "alignment": "left",
      "type": "prompt",
      "segments": [
        {
          "style": "plain",
          "foreground": "p:closer",
          "template": "\uf105",
          "type": "text"
        }
      ]
    },
    {
      "type": "prompt",
      "alignment": "right",
      "segments": [
        {
          "style": "plain",
          "foreground": "p:lavender",
          "type": "time",
          "template": "{{.CurrentDate | date .Format }}"
        }
      ]
    }
  ],
  "final_space": true,
  "version": 3
}

What OS are you seeing the problem on?

Linux

Which shell are you using?

zsh

Log output

Segments:

ConsoleTitle(false)                       -   0 ms
Os(true)                                  -   0 ms
Session(true)                             -   2 ms
Path(true)                                -   0 ms
Git(false)                                -   0 ms
Text(false)                               -   0 ms
Text(true)                                -   0 ms
Time(true)                                -   0 ms

Run duration: 4.402524ms

Cache path: /home/nucleo/.cache/oh-my-posh

Config path: /home/nucleo/omp-config/config.json

Logs:

[DEBUG] 11:42:20.014 debug.go:49 → debug mode enabled
[DEBUG] 11:42:20.014 debug.go:49 → plain mode enabled
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(LOCALAPPDATA) - 5.721µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(OMP_CACHE_DIR) - 1.563µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(XDG_CACHE_HOME) - 1.353µs
[TRACE] 11:42:20.014 terminal.go:CachePath() - 25.488µs
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache file: /home/nucleo/.cache/oh-my-posh/omp.cache
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache key: is_wsl
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache key: environment_platform
[TRACE] 11:42:20.014 terminal.go(/home/nucleo/.cache/oh-my-posh/omp.cache) - 43.953µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(LOCALAPPDATA) - 1.693µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(OMP_CACHE_DIR) - 1.262µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(XDG_CACHE_HOME) - 1.192µs
[TRACE] 11:42:20.014 terminal.go:CachePath() - 14.327µs
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache file: /home/nucleo/.cache/oh-my-posh/omp.cache.055d8f1b-9961-4cf0-825d-7c4daa36c876
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache key: prompt_count_cache
[DEBUG] 11:42:20.014 terminal.go:65 → loading cache key: template_cache
[TRACE] 11:42:20.014 terminal.go(/home/nucleo/.cache/oh-my-posh/omp.cache.055d8f1b-9961-4cf0-825d-7c4daa36c876) - 36.659µs
[TRACE] 11:42:20.014 terminal.go:setPromptCount() - 281ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 270ns
[DEBUG] 11:42:20.014 terminal.go:setPwd:194 → /home/nucleo
[TRACE] 11:42:20.014 terminal.go:setPwd() - 7.764µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → /home/nucleo/omp-config/config.json
[TRACE] 11:42:20.014 terminal.go:Getenv(POSH_THEME) - 1.773µs
[DEBUG] 11:42:20.014 terminal.go:ResolveConfigPath:93 → config set using POSH_THEME: /home/nucleo/omp-config/config.json
[TRACE] 11:42:20.014 terminal.go:ResolveConfigPath() - 5.52µs
[TRACE] 11:42:20.014 terminal.go:Init() - 191.358µs
[TRACE] 11:42:20.014 terminal.go:Shell() - 100ns
[TRACE] 11:42:20.014 terminal.go:Flags() - 30ns
[TRACE] 11:42:20.014 load.go:loadConfig() - 370.204µs
[TRACE] 11:42:20.014 terminal.go:Flags() - 40ns
[DEBUG] 11:42:20.014 debug.go:59 → terminal program: Unknown
[DEBUG] 11:42:20.014 debug.go:59 → terminal shell: zsh
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(OMP_CACHE_DISABLED) - 1.864µs
[TRACE] 11:42:20.014 colors.go:SetAccentColor() - 351ns
[TRACE] 11:42:20.014 terminal.go:Shell() - 51ns
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → 5.9
[TRACE] 11:42:20.014 terminal.go:Getenv(POSH_SHELL_VERSION) - 1.804µs
[DEBUG] 11:42:20.014 debug.go:PrintDebug:23 → segment: Title
[TRACE] 11:42:20.014 text.go:Render() - 110ns
[TRACE] 11:42:20.014 terminal.go:Flags() - 20ns
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(POSH_CURSOR_LINE) - 1.573µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(POSH_CURSOR_COLUMN) - 1.302µs
[TRACE] 11:42:20.014 terminal.go:Flags() - 20ns
[TRACE] 11:42:20.014 terminal.go:Flags() - 20ns
[TRACE] 11:42:20.014 terminal.go:Flags() - 30ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 40ns
[DEBUG] 11:42:20.014 segment.go:Execute:108 → segment: Git
[DEBUG] 11:42:20.014 terminal_unix.go:IsWsl:35 → false
[TRACE] 11:42:20.014 terminal_unix.go:IsWsl() - 4.738µs
[TRACE] 11:42:20.014 terminal_unix.go:IsWsl2() - 7.054µs
[TRACE] 11:42:20.014 terminal.go:Flags() - 230ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 80ns
[DEBUG] 11:42:20.014 terminal.go:CommandPath:395 → /usr/bin/git
[DEBUG] 11:42:20.014 segment.go:Execute:108 → segment: Session
[TRACE] 11:42:20.014 terminal.go:CommandPath(git) - 13.786µs
[TRACE] 11:42:20.014 terminal.go:HasCommand(git) - 15.97µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(SSH_CONNECTION) - 4.018µs
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.014 terminal.go:Getenv(SSH_CLIENT) - 2.875µs
[DEBUG] 11:42:20.014 git.go:shouldDisplay:326 → fetch_bare_info: false
[DEBUG] 11:42:20.014 terminal_unix.go:Platform:95 → arch
[DEBUG] 11:42:20.014 terminal.go:ResolveSymlink:287 → /home/nucleo
[TRACE] 11:42:20.014 terminal.go:ResolveSymlink(/home/nucleo) - 6.923µs
[ERROR] 11:42:20.014 terminal.go:HasParentFilePath:559 → stat .git: no such file or directory
[TRACE] 11:42:20.014 terminal.go:HasParentFilePath(.git) - 16.361µs
[TRACE] 11:42:20.014 terminal.go:Flags() - 30ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 30ns
[DEBUG] 11:42:20.014 segment.go:Execute:108 → segment: Os
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[DEBUG] 11:42:20.014 terminal_unix.go:Platform:95 → arch
[DEBUG] 11:42:20.014 os.go:Enabled:38 → display_distro_name: false
[DEBUG] 11:42:20.014 os.go:getDistroIcon:83 → 
[TRACE] 11:42:20.014 terminal_unix.go:Root() - 350ns
[TRACE] 11:42:20.014 terminal.go:Shell() - 40ns
[TRACE] 11:42:20.014 terminal.go:StatusCodes() - 40ns
[DEBUG] 11:42:20.014 terminal_unix.go:IsWsl:35 → false
[TRACE] 11:42:20.014 terminal_unix.go:IsWsl() - 1.844µs
[DEBUG] 11:42:20.014 terminal_unix.go:IsWsl:35 → false
[TRACE] 11:42:20.014 terminal_unix.go:IsWsl() - 1.583µs
[TRACE] 11:42:20.014 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 31ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 31ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[DEBUG] 11:42:20.014 terminal.go:User:331 → nucleo
[TRACE] 11:42:20.014 terminal.go:User() - 2.354µs
[DEBUG] 11:42:20.014 terminal.go:Host:348 → nucleofusion
[TRACE] 11:42:20.014 terminal.go:Host() - 2.946µs
[TRACE] 11:42:20.014 terminal.go:GOOS() - 20ns
[DEBUG] 11:42:20.014 terminal_unix.go:Platform:95 → arch
[DEBUG] 11:42:20.014 terminal.go:Getenv:161 → 1
[TRACE] 11:42:20.014 terminal.go:Getenv(SHLVL) - 1.693µs
[TRACE] 11:42:20.014 terminal.go:TemplateCache() - 44.955µs
[TRACE] 11:42:20.015 terminal.go:Flags() - 250ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 170ns
[DEBUG] 11:42:20.015 segment.go:Execute:108 → segment: Path
[DEBUG] 11:42:20.015 path.go:145 → display_cygpath: false
[TRACE] 11:42:20.015 terminal.go:GOOS() - 80ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 60ns
[TRACE] 11:42:20.015 terminal.go:PathSeparator() - 4.729µs
[TRACE] 11:42:20.015 terminal.go:Shell() - 120ns
[TRACE] 11:42:20.015 terminal.go:Shell() - 110ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 71ns
[DEBUG] 11:42:20.015 path.go:setMappedLocations:552 → mapped_locations_enabled: true
[DEBUG] 11:42:20.015 path.go:setMappedLocations:553 → 
[DEBUG] 11:42:20.015 path.go:setMappedLocations:554 → 
[TRACE] 11:42:20.015 terminal.go:GOOS() - 50ns
[TRACE] 11:42:20.015 terminal.go:PathSeparator() - 227.085µs
[TRACE] 11:42:20.015 terminal.go:GOOS() - 50ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[DEBUG] 11:42:20.015 path.go:setMappedLocations:555 → ~
[DEBUG] 11:42:20.015 path.go:setMappedLocations:560 → mapped_locations: map[]
[TRACE] 11:42:20.015 terminal.go:GOOS() - 70ns
[TRACE] 11:42:20.015 terminal.go:PathSeparator() - 3.777µs
[TRACE] 11:42:20.015 terminal.go:GOOS() - 50ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 41ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:PathSeparator() - 2.835µs
[TRACE] 11:42:20.015 terminal.go:GOOS() - 50ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 20ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 30ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 40ns
[TRACE] 11:42:20.015 terminal.go:Flags() - 40ns
[DEBUG] 11:42:20.015 path.go:colorizePath:728 → cycle: []
[DEBUG] 11:42:20.015 path.go:getFolderSeparator:263 → NO DATA
[DEBUG] 11:42:20.015 path.go:getFolderSeparator:265 → /
[DEBUG] 11:42:20.015 path.go:colorizePath:731 → cycle_folder_separator: false
[DEBUG] 11:42:20.015 path.go:colorizePath:732 → %s
[DEBUG] 11:42:20.015 path.go:colorizePath:734 → %s
[DEBUG] 11:42:20.015 path.go:colorizePath:735 → %s
[DEBUG] 11:42:20.015 path.go:colorizePath:736 → %s
[TRACE] 11:42:20.015 terminal.go:TemplateCache() - 60ns
[TRACE] 11:42:20.015 terminal.go:GOOS() - 20ns
[TRACE] 11:42:20.015 terminal.go:StackCount() - 61ns
[TRACE] 11:42:20.015 terminal_unix.go:DirIsWritable(/home/nucleo) - 2.865µs
[TRACE] 11:42:20.015 terminal.go:TemplateCache() - 30ns
[TRACE] 11:42:20.015 terminal.go:TemplateCache() - 331ns
[TRACE] 11:42:20.015 text.go:Render({{.Icon}} ) - 689.392µs
[TRACE] 11:42:20.015 terminal.go:TemplateCache() - 80ns
[TRACE] 11:42:20.015 text.go:Render(plain) - 190ns
[DEBUG] 11:42:20.016 terminal.go:RunCommand:371 → NO DATA
[TRACE] 11:42:20.016 terminal.go:RunCommand(who am i) - 2.029695ms
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 80ns
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 110ns
[TRACE] 11:42:20.016 text.go:Render({{ .UserName }} ) - 108.954µs
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 30ns
[TRACE] 11:42:20.016 text.go:Render(plain) - 101ns
[TRACE] 11:42:20.016 text.go:Render({{ .Path }} ) - 9.868µs
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 30ns
[TRACE] 11:42:20.016 text.go:Render(plain) - 90ns
[TRACE] 11:42:20.016 text.go:Render(plain) - 70ns
[TRACE] 11:42:20.016 terminal.go:Shell() - 60ns
[TRACE] 11:42:20.016 terminal.go:Shell() - 20ns
[TRACE] 11:42:20.016 terminal.go:Flags() - 50ns
[TRACE] 11:42:20.016 terminal.go:GOOS() - 40ns
[DEBUG] 11:42:20.016 segment.go:Execute:108 → segment: Text
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 30ns
[TRACE] 11:42:20.016 text.go:Render( ) - 491ns
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 70ns
[TRACE] 11:42:20.016 text.go:Render(plain) - 181ns
[TRACE] 11:42:20.016 terminal.go:Flags() - 110ns
[TRACE] 11:42:20.016 terminal.go:GOOS() - 31ns
[DEBUG] 11:42:20.016 segment.go:Execute:108 → segment: Text
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 40ns
[TRACE] 11:42:20.016 text.go:Render() - 120ns
[TRACE] 11:42:20.016 terminal.go:TemplateCache() - 20ns
[TRACE] 11:42:20.016 text.go:Render(plain) - 50ns
[TRACE] 11:42:20.016 terminal.go:Shell() - 30ns
[TRACE] 11:42:20.016 terminal.go:Shell() - 30ns
[TRACE] 11:42:20.017 terminal.go:Flags() - 40ns
[TRACE] 11:42:20.017 terminal.go:GOOS() - 20ns
[DEBUG] 11:42:20.017 segment.go:Execute:108 → segment: Time
[DEBUG] 11:42:20.017 time.go:Enabled:27 → 15:04:05
[TRACE] 11:42:20.017 terminal.go:TemplateCache() - 30ns
[TRACE] 11:42:20.017 terminal.go:TemplateCache() - 160ns
[TRACE] 11:42:20.017 text.go:Render({{.CurrentDate | date .Format }}) - 130.966µs
[TRACE] 11:42:20.017 terminal.go:TemplateCache() - 20ns
[TRACE] 11:42:20.017 text.go:Render(plain) - 130ns
[DEBUG] 11:42:20.018 terminal_unix.go:TerminalWidth:88 → terminal width: 195
[TRACE] 11:42:20.018 terminal_unix.go:TerminalWidth() - 1.224275ms
[TRACE] 11:42:20.018 terminal.go:Shell() - 50ns
[TRACE] 11:42:20.018 terminal.go:Shell() - 30ns
[TRACE] 11:42:20.018 terminal.go:Shell() - 60ns
[TRACE] 11:42:20.018 terminal.go:Flags() - 30ns
[DEBUG] 11:42:20.018 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.018 terminal.go:Getenv(LOCALAPPDATA) - 7.815µs
[DEBUG] 11:42:20.018 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.018 terminal.go:Getenv(OMP_CACHE_DIR) - 3.227µs
[DEBUG] 11:42:20.018 terminal.go:Getenv:161 → NO DATA
[TRACE] 11:42:20.018 terminal.go:Getenv(XDG_CACHE_HOME) - 2.985µs
[TRACE] 11:42:20.018 terminal.go:CachePath() - 40.516µs
[TRACE] 11:42:20.018 terminal.go:Flags() - 80ns
JanDeDobbeleer commented 2 weeks ago

@NucleoFusion you added the newline to the segment but it needs to be on block:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "palette": {
    "os": "#ACB0BE",
    "closer": "p:os",
    "pink": "#F4B8E4",
    "lavender": "#BABBF1",
    "blue": "#8CAAEE"
  },
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "foreground": "p:os",
          "style": "plain",
          "template": "{{.Icon}} ",
          "type": "os"
        },
        {
          "foreground": "p:blue",
          "style": "plain",
          "template": "{{ .UserName }} ",
          "type": "session"
        },
        {
          "foreground": "p:lavender",
          "properties": {
            "folder_icon": "..\ue5fe..",
            "home_icon": "~",
            "style": "folder"
          },
          "style": "plain",
          "template": "{{ .Path }} ",
          "type": "path"
        },
        {
          "foreground": "p:blue",
          "properties": {
            "branch_icon": "\ue725 ",
            "cherry_pick_icon": "\ue29b ",
            "commit_icon": "\uf417 ",
            "fetch_status": false,
            "fetch_upstream_icon": false,
            "merge_icon": "\ue727 ",
            "no_commits_icon": "\uf0c3 ",
            "rebase_icon": "\ue728 ",
            "revert_icon": "\uf0e2 ",
            "tag_icon": "\uf412 "
          },
          "template": "{{ .HEAD }} ",
          "style": "plain",
          "type": "git"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "type": "prompt",
      "newline": true
      "segments": [
        {
          "style": "plain",
          "foreground": "p:closer",
          "template": "\uf105",
          "type": "text"
        }
      ]
    },
    {
      "type": "prompt",
      "alignment": "right",
      "segments": [
        {
          "style": "plain",
          "foreground": "p:lavender",
          "type": "time",
          "template": "{{.CurrentDate | date .Format }}"
        }
      ]
    }
  ],
  "final_space": true,
  "version": 3
}