Open stevehjohn opened 1 year ago
Interesting. Is something else in your $PROFILE
providing a custom prompt
? posh-git won't override if prompt
has changed from the default:
https://github.com/dahlbyk/posh-git/blob/4b746d6e48f8d40aa4a52f14951597157cfda137/src/posh-git.psm1#L140-L144
Does Get-Item Function:\prompt | Select -Exp Definition
match the posh-git prompt that starts here?
https://github.com/dahlbyk/posh-git/blob/4b746d6e48f8d40aa4a52f14951597157cfda137/src/posh-git.psm1#L33-L35
My $PROFILE file is empty.
Get-Item Function:\prompt | Select -Exp Definition
Returns the following...
$realLASTEXITCODE = $LASTEXITCODE
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
CmderPrompt
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
$global:LASTEXITCODE = $realLASTEXITCODE
return " "
This is identical to what it returns on another machine where the prompt works.
Thanks,
Steve.
If $PROFILE
is empty, is posh-git loading from one of the other profile locations?
$PROFILE.AllUsersAllHosts
$PROFILE.AllUsersCurrentHost
$PROFILE.CurrentUserAllHosts
$PROFILE.CurrentUserCurrentHost
Hi,
Sorry, but they are all empty. Here is the script Cmder runs on startup if it helps...
https://gist.github.com/stevehjohn/a3d59cd0393f976b3e5c89c1a2f67777
Thanks,
Steve.
And this same Cmder script has the expected behavior on other systems? I would expect this to be a problem everywhere: https://gist.github.com/stevehjohn/a3d59cd0393f976b3e5c89c1a2f67777#file-profile-ps1-L178-L182. Importing posh-git after a custom prompt
exists will skip overwriting it. You can override that on import, or just import posh-git first. The Cmder script has a similar check to avoid overwriting a custom prompt
.
Do you have a user_profile.ps1
or config\profile.d\*.ps1
on any of these systems?
Hey,
Yep all appears to be the same. I really don't know why one works and the other doesn't.
I don't want to waste too much of your time. I'll keep chipping away at it and see if I can get it working.
Feel free to close this issue, or leave it open if you'd like me to update with a solution if/when I find one.
Thanks,
Steve.
You might try asking the Cmder folks? I know they've put effort into making it Just Work, so they may have ideas. Sorry!
System Details
Issue Description
Hi,
The posh-git prompt is not appearing even though the module is imported as verified by manually calling
$GitPromptScriptBlock.Invoke()
.I've used posh-git many times and still am on 2 other machines... something is just not working in this case.
As with the other machines, the terminal is cmder. I cannot figure out what is causing this.
Sorry to add to your issues.
Steve.