Coder Social home page Coder Social logo

Comments (7)

dahlbyk avatar dahlbyk commented on June 2, 2024

Interesting. Is something else in your $PROFILE providing a custom prompt? posh-git won't override if prompt has changed from the default:

posh-git/src/posh-git.psm1

Lines 140 to 144 in 4b746d6

# If there is no prompt function or the prompt function is the default, replace the current prompt function definition
if ($ForcePoshGitPrompt -or !$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) {
# Set the posh-git prompt as the default prompt
Set-Item Function:\prompt -Value $GitPromptScriptBlock
}

Does Get-Item Function:\prompt | Select -Exp Definition match the posh-git prompt that starts here?

$GitPromptScriptBlock = {
$origDollarQuestion = $global:?
$origLastExitCode = $global:LASTEXITCODE

from posh-git.

stevehjohn avatar stevehjohn commented on June 2, 2024

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.

from posh-git.

dahlbyk avatar dahlbyk commented on June 2, 2024

If $PROFILE is empty, is posh-git loading from one of the other profile locations?

  • $PROFILE.AllUsersAllHosts
  • $PROFILE.AllUsersCurrentHost
  • $PROFILE.CurrentUserAllHosts
  • $PROFILE.CurrentUserCurrentHost

from posh-git.

stevehjohn avatar stevehjohn commented on June 2, 2024

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.

from posh-git.

dahlbyk avatar dahlbyk commented on June 2, 2024

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?

from posh-git.

stevehjohn avatar stevehjohn commented on June 2, 2024

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.

from posh-git.

dahlbyk avatar dahlbyk commented on June 2, 2024

You might try asking the Cmder folks? I know they've put effort into making it Just Work, so they may have ideas. Sorry!

from posh-git.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.