-
-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move simple prompt to the module. #217
Comments
In that case, it would have to be optional and off by default. Many folks I know have highly customized prompts and with PowerShell there can only be one prompt function. If importing posh-git stomped their prompt function, they wouldn't be happy. Other than that, it seems like a reasonable request. |
(First, terribly sorry for basically ignoring this for a year @thezim!) As I mentioned in the PowerLine issue referenced above...
|
To get the default prompt, you can use [runspace]::DefaultRunspace.InitialSessionState.Commands['prompt'].Definition There are some rare cases where this might not work in some hosts, but it should work in |
We can use However, in the scenario where the user remove's the posh-git module, we should attempt to restore the original prompt function. |
I have an implementation that I have submitted as PR #349 for folks to look at. The one issue with it is that because it exports prompt, removing posh-git will remove the prompt function altogether. This leaves with the prompt I've been trying to restore the prompt in Perhaps this isn't that big of a deal? Not sure how often folks would do a |
Fix #217. This would only export the prompt function if the prompt function is still set to the default.
Instead of exporting the function, why not use If you are defining a prompt for folks, do look closely at how the default prompt function changes when debugging, see: |
That works better! Thx. The debug prompt changes only seem to take effect when the default prompt is in place. Are you suggesting we provide the same debug info in the posh-git prompt during debugging? I think we could do that pretty easily, just want to make sure that's what you're suggesting. |
My preferred prompt spans two lines. If you make that the default, you need to tell PSReadline with |
Hmm, I've been using a two line prompt for over a year without setting that PSReadline option. And I haven't noticed any ill effects. Looking at the help on this parameter:
But if I get PSReadline to display a long list of completions (say contents of \windows) when I complete or esc, both lines of my prompt are displayed. |
In Emacs mode, try 'Measure-
|
I use the |
From #349 (comment):
Keeping the default prompt reasonably simple also means we can skip the |
I frequently use PowerShell for many tasks and have many modules that I do not load automatically in my profile. When loading posh-git I have to manually execute the simple prompt code. Moving the simple prompt to the module make the it more user friendly.
The text was updated successfully, but these errors were encountered: