Closed eddynaka closed 3 years ago
Did you follow the upgrade process? https://ohmyposh.dev/docs/upgrading/ The list of built-in themes is available here: https://ohmyposh.dev/docs/themes
Hello,
yes. Now, I'm using powerline, but I still don't know how to fix the duplicate information (ss above) and how to add the time aligned to the right.
@eddynaka that message is coming from posh-git, same as the git status prefix you're seeing. You need to update your git using git for windows and can disable that prefix via their settings (I think using $PoshGitPromptSettings. EnablePromptStatus=$false
). Paradox is available using Set-PoshPrompt paradox
.
hi @JanDeDobbeleer , interesting! Because I'm using git for windows, the only different thing is that that is vfs style.
I tried to add this to my $PROFILE:
$GitPromptSettings.AnsiConsole = $false
$GitPromptSettings.EnablePromptStatus = $false
but yet it didn't work.
How do i configure the time to the right? is it possible?
@eddynaka quick question, do you import oh-my-posh first or posh-git?
Hi @JanDeDobbeleer , this is my current config:
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme ~/.oh-my-posh.omp.json
$GitPromptSettings.AnsiConsole = $false
$GitPromptSettings.EnablePromptStatus = $false
Do I need to use both?
@eddynaka here's a sample of paradox with the time on the right:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "root",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#ffe9aa"
},
{
"type": "session",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#ffffff"
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#91ddff",
"properties": {
"folder_icon": "\uF115",
"folder_separator_icon": " \uE0B1 ",
"style": "full"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4"
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#906cff",
"properties": {
"prefix": " \uE235 "
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"prefix": " \uE20F"
}
}
]
},
{
"type": "prompt",
"alignment": "right",
"segments": [
{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"time_format": "15:04:05"
}
}
]
},
{
"type": "newline"
},
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"prefix": "",
"text": "\u276F"
}
}
]
}
],
"final_space": false
}
@eddynaka you can use oh-my-posh without posh-git. Also, which theme is that? Because paradox is shipped with the module.
@lnu , thanks!
@JanDeDobbeleer , i think it's not shipping anymore. At least, the get-theme does not show it!
@JanDeDobbeleer , without posh-git, it does not show the part: "1 to push 1 uncommited".
@eddynaka Get-Theme
isn't a cmdlet anymore, you can use Get-PoshThemes
.
got it! that fixed the time to the right and the warning string.
But I lost the part of the string where it showed the git part.
@eddynaka So what does it look like now?
Hi @lnu , below a SS:
It's in main, but i have un-committed things, so before the upgrade it was showing the numbers like [x y z].
@eddynaka what does git status say? Because in the first screenshot, both posh-git and oh-my-posh report the same.
In theory, i have a change in the submodule, so the submodule always showed me as a change that i had to make or fix.
doing the same to a specific place, i can see something different:
am i missing icons? os the number 0 is correct there?
thank u again
for the missing icons you need to use one of the Nerd Fonts:https://ohmyposh.dev/docs/fonts
@eddynaka support for submodules is likely something I have to add. I'll check back in the morning.
Hi @JanDeDobbeleer , got it.
strangely that i'm sure that that was working. but i dont know if that was because of the other import :)
let me try to update the fonts
@JanDeDobbeleer @eddynaka in the meantime, you can use the posh git segment instead of the git segment as a workaround for the submodule status.
how do i do that?
try to enable disable with this config(let both to see the difference and enable the one you want to keep):
{
"type": "poshgit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4"
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4"
},
for the posh git segment, you need to have this in your ps profile:
import-module posh-git
$GitPromptSettings.EnableFileStatus = $true
$GitPromptSettings.EnablePromptStatus = $true
Not sure for the EnableFileStatus but you definitely need the EnablePromptStatus.
With both enabled you'll get something like this:
Fixed the icons.
i will try later the configs above. thank you!
@eddynaka can you give the output of git --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --short --branch
when in that state?
I have duplicated git status information too if I Import-Module posh-git
.
I keep Import-Module posh-git
because it provides the auto-complete feature for git.
@maidamai0 And that's the reason I still import it too. But the git information should not be duplicated. What's your configuration(terminal, shell, ps profile, ...)?
@maidamai0 did you import posh-git before oh-my-posh? Might want to try the other way around according to what I'm reading.
@lnu
Windows terminal
poweshell 7.1.3
Import-Module posh-git
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
Set-PoshPrompt -Theme ~/.oh-my-posh.omp.json # based on star.omp.json
New-Alias ll ls
function Enter-AdminPSSession {
Start-Process -Verb RunAs (Get-Process -Id $PID).Path
}
# Optionally also define a short alias name:
# Note: 'psadmin' is a nonstandard alias name; a more conformant name would be
# the somewhat clunky 'etasn'
# ('et' for 'Enter', 'a' for admin, and 'sn'` for session)
Set-Alias psadmin Enter-AdminPSSession
Import-Module 'C:\Users\michael\Documents\vcpkg\scripts\posh-vcpkg'
@JanDeDobbeleer
Yes I import posh-git
before oh-my-posh
@maidamai0 swap those two please (add it after the Set-PoshPrompt
statement)
@JanDeDobbeleer Still have duplicated git status
The order of the import has no impact, I swapped both to test and I still have only one status. Could you put a screenshot of the prompt? and the content of your custom theme?
@lnu according to the docs it does actually. When posh-git detects a custom prompt it doesn't set it. But I asked the creator as the behavior seems to differ per person and I don't see what's causing it.
@lnu
I set to the build-in star
theme and it has duplicated info too:
Get-PoshThemes
shows correctly, if this helps.
And if you remove the posh git import the duplicated status is gone?
Could you also print the result of get-module
?
Yes, the duplicated status gone if I remove the the posh-git form profile
get-module
gives:
I'm using posh-git 1.0.0. If I rollback to your version I get the same issue: Please update to the latest version of posh-git and it should work.
upgrade posh-git
fixed this issue, Thank you!
@JanDeDobbeleer the issue is related to this commit 320ec1d7d32467dfa924f929cd1849fc3c1e4b77 If posh git functions are called before the rendering, it adds itself at the start. Since the issue is only related to an old version of posh git, we can safely tell people to always use posh-git > 1.0.0 I remember we already had this issue a loooonnnnggg time ago.
Let's get this back on track. @eddynaka can you give the output of git --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --short --branch
when in that state?
Hello,
below the result:
@eddynaka can you copy that output as text for me? I already see a lowercase m rather than a uppercase one. Can you also modify a file in the repo (not the submodule) for me so I can see the difference?
Of course!
❯ git --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --short --branch
## main...origin/main
m src/sarif-pattern-matcher
with some file modification:
❯ git --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --short --branch
## main...origin/main
M src/Plugins/Tests.Security.Internal/Validators/SEC101_001.HttpAuthorizationRequestHeaderValidatorTests.cs
m src/sarif-pattern-matcher
@eddynaka fix incoming, missed that little bit of information. From the docs:
Submodules have more state and instead report M the submodule has a different HEAD than recorded in the index m the submodule has modified content ? the submodule has untracked files since modified content or untracked files in a submodule cannot be added via git add in the superproject to prepare a commit. m and ? are applied recursively. For example if a nested submodule in a submodule contains an untracked file, this is reported as ? as well.
@JanDeDobbeleer , with that, i wouldn't need the other extension, right? Only with oh-my-posh it would be enough to track everything
@eddynaka correct
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Prerequisites
CONTRIBUTING
guideDescription
After updating, I started to see this:
Also, I'm seeing duplicated information:
I saw that you don't have the Paradox theme anymore. It had a nice feature (the time to the right), but I don't know how to add it again.
Environment