description
I import posh-git but don't use its prompt style. and my windows terminal $PROFILE like:
-
Import-Module posh-git Import-Module oh-my-posh Set-PoshPrompt -Theme default #$env:POSH_GIT_ENABLED = $true
-
I have read the similar question [Windows Terminal + oh-my-posh not showing git status and made the theme file change, but it also doesn't work.
the "git" segment of the theme file like:
{ "type": "git", "background": "p:green", "background_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}", "{{ if gt .Ahead 0 }}#49416D{{ end }}", "{{ if gt .Behind 0 }}#7A306C{{ end }}" ], "foreground": "p:black", "foreground_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}", "{{ if gt .Ahead 0 }}p:white{{ end }}" ], "powerline_symbol": "\ue0b0", "properties": { "display_status": true, "display_stash_count": true, "display_upstream_icon": true, "branch_max_length": 25, "fetch_status": true, "fetch_upstream_icon": true, "github_icon": "\uf7a3" }, "style": "powerline", "template": " {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} " },
all the display properties("display_status" ...) are true.
image:
it doesn't display git status!! why?? the pic
Question
I just want to know whether oh-my-posh has deprecated the git status display ???
and I have read the oh-my-posh Blog page, there is no changes on git status display
oh-my-posh
has deprecated their PowerShell module and is asking users to migrate. So as a first step, run the migration steps outlined in the docs and replaceImport-Module oh-my-posh
as well asSet-PoshPrompt -Theme default
with, for example,Uncomment
so
posh-git
is enabled. Theposh-git
prompt is disabled by default:In the
posh-git
README, it says:Good, so this is what we're after: using
oh-my-posh
over theposh-git
prompt. So how do we get the latter into the former?In your
oh-my-posh.omp.json
configuration file, add a segment at a position of your choice:The relevant difference here is that this is of type
poshgit
, not of typegit
anymore (the latter being theoh-my-posh
"builtin" as far as I see).This works for me™, as a first approximation. You'll need to add custom
foreground_template
magic etc. to further customize it, but these settings should allow theposh-git
prompt to at least display from within youroh-my-posh
one.