Skip to content

"alignment": "right" for $ENV:POSH_GIT_STRING not working #3805

Description

@pranavpa8788

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

I've been customizing the fish theme and according to the docs I installed posh-git since its convinient to use the $ENV:POST_GIT_STRING variable. It renders but on the left leaving a large gap before it (image 1) when using

"alignment" : "right"

it looks like this

image

"alignment": "left"

produces this

image

This is where all the omp stuff is in my powershell profile

Import-Module path_to_scoop\\apps\posh-git\1.1.0\posh-git.psd1

function Set-PoshGitStatus {
    $global:GitStatus = Get-GitStatus
    $env:POSH_GIT_STRING = Write-GitStatus -Status $global:GitStatus
}
New-Alias -Name 'Set-PoshContext' -Value 'Set-PoshGitStatus' -Scope Global -Force

oh-my-posh --init --shell pwsh --config 'path_to_omp_themes\fish.omp.json' | Invoke-Expression

Btw, thank you for such a great plugin, been using it for years and has been working very smoothly. Any help is appreciated!
I've specified my config below

Theme

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
          {
      "alignment": "right",
      "segments": [
          {
              "foreground": "#ffffff",
              "style": "diamond",
              "template": " {{ .Env.POSH_GIT_STRING }} ",
              "type": "git"
          }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "segments": [
        {
          "foreground": "#ffffff",
          "style": "plain",
          "template": " {{ .Meaning }}",
          "type": "exit"
        },
        {
          "foreground": "#100e23",
          "style": "plain",
          "template": " \uf0e7 ",
          "type": "root"
        },
        {
          "background": "#343434",
          "foreground": "#ffffff",
          "style": "plain",
          "template": " {{ .UserName }}@{{ .HostName }} \uf0a9 ",
          "type": "session"
        },
        {
          "background": "#343434",
          "foreground": "#ffffff",
          "properties": {
            "folder_icon": "\uf115",
            "folder_separator_icon": " \ue0b1 ",
            "style": "full"
          },
          "style": "plain",
          "template": "{{ .Path }} ",
          "type": "path"
        },
        {
          "background": "#343434",
          "foreground": "#ffffff",
          "style": "plain",
          "template": "<#ffffff>\ue0b1</> {{ .HEAD }} ",
          "type": "git"
        },
        {
          "foreground": "#343434",
          "style": "plain",
          "template": "\ue0b0 ",
          "type": "text"
        }
      ],
      "type": "prompt"
    }
  ],
  "version": 2
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 15.4.2

Shell: pwsh (7.3.4)

Segments:

ConsoleTitle(false)                       -   0 ms - 
git(true)                                 -   2 ms -   �[93m[�[39m�[96mpowershell�[39m�[96m Γëí�[39m�[32m +0�[39m�[32m ~1�[39m�[32m -0�[39m�[93m |�[39m�[31m +3�[39m�[31m ~2�[39m�[31m -0�[39m�[31m !�[39m�[93m]�[39m 
exit(false)                               -   0 ms - 
root(false)                               -   0 ms - 
session(true)                             -   0 ms -  nathan@IDEAPAD_3  
path(true)                                -   0 ms - ~  Documents  PowerShell 
git(true)                                 -   0 ms -  powershell 
text(true)                                -   0 ms -  

Run duration: 16.8204ms

Cache path: ~\AppData\Local\oh-my-posh

Config path: ~\Documents\PowerShell\OMP_Themes\fish.omp.json

Logs:

[DEBUG] 03:18:34.102 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.102 shell.go:Getenv(TERM_PROGRAM) - 0s
[DEBUG] 03:18:34.102 shell.go:Getenv:394 → ~\AppData\Local
[TRACE] 03:18:34.102 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 03:18:34.102 shell_windows.go:CachePath() - 509.5┬╡s
[DEBUG] 03:18:34.111 shell.go:Getenv:394 → ~\Documents\PowerShell\OMP_Themes\fish.omp.json
[TRACE] 03:18:34.111 shell.go:Getenv(POSH_THEME) - 0s
[DEBUG] 03:18:34.115 shell.go:Shell:641 → process name: pwsh.exe
[TRACE] 03:18:34.115 shell.go:Shell() - 4.0772ms
[TRACE] 03:18:34.115 shell.go:resolveConfigPath() - 4.0772ms
[TRACE] 03:18:34.115 shell.go:Init() - 13.2569ms
[TRACE] 03:18:34.115 shell.go:Flags() - 0s
[TRACE] 03:18:34.116 config.go:loadConfig() - 1.0295ms
[TRACE] 03:18:34.116 shell.go:Flags() - 0s
[DEBUG] 03:18:34.116 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.116 shell.go:Getenv(OMP_CACHE_DISABLED) - 0s
[TRACE] 03:18:34.116 shell_windows.go:WindowsRegistryKeyValue(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.116 shell_windows.go:WindowsRegistryKeyValue:206 → ColorizationColor(DWORD): 0xC43F3F3F
[TRACE] 03:18:34.116 shell.go:Shell() - 0s
[DEBUG] 03:18:34.116 shell.go:Getenv:394 → 7.3.4
[TRACE] 03:18:34.116 shell.go:Getenv(POSH_SHELL_VERSION) - 0s
[DEBUG] 03:18:34.116 debug.go:PrintDebug:22 → Segment: Title
[TRACE] 03:18:34.116 shell.go:Flags() - 0s
[DEBUG] 03:18:34.116 block.go:Debug:230 → Segment: git
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.116 shell.go:Pwd:424 → ~\Documents\PowerShell
[TRACE] 03:18:34.116 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.116 shell_windows.go:56 → ~
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[TRACE] 03:18:34.116 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:CommandPath:596 → C:\Program Files\Git\cmd\git.exe
[TRACE] 03:18:34.119 shell.go:CommandPath(git.exe) - 2.534ms
[TRACE] 03:18:34.119 shell.go:HasCommand(git.exe) - 2.534ms
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[TRACE] 03:18:34.119 shell.go:HasParentFilePath(.git) - 0s
[DEBUG] 03:18:34.119 properties.go:GetStringArray:52 → exclude_folders: []
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.119 shell.go:Getenv(POSH_GIT_STATUS) - 0s
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → fetch_status: false
[DEBUG] 03:18:34.119 properties.go:GetStringArray:52 → ignore_status: []
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:FileContent:519 Γåô
    ref: refs/heads/powershell
    
[TRACE] 03:18:34.119 shell.go:FileContent(~\Documents\PowerShell\.git/HEAD) - 0s
[DEBUG] 03:18:34.119 properties.go:GetString:28 → 
[DEBUG] 03:18:34.119 properties.go:GetInt:40 → branch_max_length: 0
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → fetch_upstream_icon: false
[TRACE] 03:18:34.119 shell_windows.go:Root() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[TRACE] 03:18:34.119 shell.go:ErrorCode() - 0s
[TRACE] 03:18:34.119 shell_windows.go:IsWsl() - 0s
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:User:545 → nathan
[TRACE] 03:18:34.119 shell.go:User() - 0s
[DEBUG] 03:18:34.119 shell.go:Host:557 → IDEAPAD_3
[TRACE] 03:18:34.119 shell.go:Host() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.119 shell.go:Getenv(SHLVL) - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[TRACE] 03:18:34.119 shell.go:Flags() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: exit
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:ErrorCode() - 0s
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → always_enabled: false
[TRACE] 03:18:34.119 shell.go:ErrorCode() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: root
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell_windows.go:Root() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: session
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.119 shell.go:Getenv(SSH_CONNECTION) - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.119 shell.go:Getenv(SSH_CLIENT) - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: path
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[TRACE] 03:18:34.119 shell.go:Flags() - 0s
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → mapped_locations_enabled: true
[DEBUG] 03:18:34.119 properties.go:GetString:28 → 
[DEBUG] 03:18:34.119 properties.go:GetString:28 → 
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 properties.go:GetString:28 → ~
[DEBUG] 03:18:34.119 properties.go:GetKeyValueMap:46 → mapped_locations: map[]
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[DEBUG] 03:18:34.119 properties.go:GetString:28 → full
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[DEBUG] 03:18:34.119 properties.go:GetStringArray:52 → cycle: []
[DEBUG] 03:18:34.119 properties.go:GetString:28 → NO DATA
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[DEBUG] 03:18:34.119 properties.go:GetString:28 →   
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → cycle_folder_separator: false
[TRACE] 03:18:34.119 shell.go:PathSeparator() - 0s
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[TRACE] 03:18:34.119 shell_windows.go:IsWsl() - 0s
[TRACE] 03:18:34.119 shell.go:StackCount() - 0s
[DEBUG] 03:18:34.119 win32_windows.go:isWriteable:299 → not current user or in group
[DEBUG] 03:18:34.119 win32_windows.go:isWriteable:303 → current user is member of S-1-5-32-544
[DEBUG] 03:18:34.119 win32_windows.go:isWriteable:311 Γåô
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 03:18:34.119 win32_windows.go:isWriteable:313 → user has write access
[TRACE] 03:18:34.119 shell_windows.go:DirIsWritable() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: git
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:CommandPath:590 → C:\Program Files\Git\cmd\git.exe
[TRACE] 03:18:34.119 shell.go:CommandPath(git.exe) - 0s
[TRACE] 03:18:34.119 shell.go:HasCommand(git.exe) - 0s
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[TRACE] 03:18:34.119 shell.go:HasParentFilePath(.git) - 0s
[DEBUG] 03:18:34.119 properties.go:GetStringArray:52 → exclude_folders: []
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → NO DATA
[TRACE] 03:18:34.119 shell.go:Getenv(POSH_GIT_STATUS) - 0s
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → fetch_status: false
[DEBUG] 03:18:34.119 properties.go:GetStringArray:52 → ignore_status: []
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[DEBUG] 03:18:34.119 shell.go:FileContent:519 Γåô
    ref: refs/heads/powershell
    
[TRACE] 03:18:34.119 shell.go:FileContent(~\Documents\PowerShell\.git/HEAD) - 0s
[DEBUG] 03:18:34.119 properties.go:GetString:28 → 
[DEBUG] 03:18:34.119 properties.go:GetInt:40 → branch_max_length: 0
[DEBUG] 03:18:34.119 properties.go:GetBool:22 → fetch_upstream_icon: false
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[DEBUG] 03:18:34.119 block.go:Debug:230 → Segment: text
[TRACE] 03:18:34.119 shell.go:Pwd() - 0s
[DEBUG] 03:18:34.119 shell_windows.go:56 → ~
[TRACE] 03:18:34.119 shell.go:GOOS() - 0s
[TRACE] 03:18:34.119 shell.go:TemplateCache() - 0s
[TRACE] 03:18:34.119 shell.go:Shell() - 0s
[DEBUG] 03:18:34.119 shell.go:Getenv:394 → ~\AppData\Local
[TRACE] 03:18:34.119 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 03:18:34.119 shell_windows.go:CachePath() - 0s
[TRACE] 03:18:34.119 shell.go:Flags() - 0s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🐛 bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions