描述
- Import-Module posh-git Import-Module oh-my-posh Set-PoshPrompt -Theme default #$env:POSH\_GIT\_ENABLED = $true- 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 }} " },所有显示属性(“display_status”)都是真的。
图片:
它不显示git状态!!为什么??图图
问题
我只想知道,噢-我的时髦是否反对git状态显示?
我读过哦-我的-时髦的博客页面,git状态显示没有任何变化。
发布于 2022-05-30 11:03:10
oh-my-posh不推荐他们的PowerShell模块和是要求用户迁移。因此,作为第一步,运行文档中概述的迁移步骤,并将Import-Module oh-my-posh和Set-PoshPrompt -Theme default替换为,例如,
噢-我的-时髦的init pwsh --config ~/.custom.omp.json \Invoke表达式posh-git。posh-git提示符默认情况下禁用。:
PowerShell为自动完成提供了对posh-git模块的支持,但默认情况下是禁用的。要启用此功能,请在您的$env:POSH_GIT_ENABLED = $true中设置$PROFILE。很好,这就是我们要做的:在oh-my-posh提示符上使用posh-git。那么,我们如何使后者进入前者呢?
oh-my-posh.omp.json配置文件中,添加位于您选择的位置:
{“类型”:"poshgit“、”样式“:"powerline”、"powerline_symbol":"\uE0B0“、”前台“:"#ffffff”、“背景”:"#0077c2“}
这里的相关区别是,这是类型poshgit,而不再是git类型(据我所见,后者是oh-my-posh“内置的”)。这对我来说是可行的,™,作为一种近似。您需要添加自定义foreground_template魔术等来进一步自定义它,但是这些设置应该允许posh-git提示符至少在oh-my-posh提示中显示。
https://stackoverflow.com/questions/71923201
复制相似问题