Ehryk / ContextMenuTools

This is a collection of helpful context menu items, including "Start PowerShell Here" and "Git Bash Here". What the installers do is add these and other selected options to your Windows right-click menus (tested in XP, Vista, 7 and 8) for ease of accessing command prompts right to the current directory.
http://www.ericmenze.com
Other
28 stars 6 forks source link

Conflicts with Git-Posh PowerShell Prompt integration #1

Open iangregsondev opened 10 years ago

iangregsondev commented 10 years ago

Hi,

Cool set of addons. Although when opening powershell it executes my powershell profile located here

  %UserProfile%\My Documents\WindowsPowerShell\profile.ps1 

But when I open via your context menu I notice the profile isn't being executed. I know this because I have PoshGit installed so it changed my PROMPT so show current branch etc of Git and in the powershell that is launched via your context menu, it doesn't show anything.

Any ideas how I can modify it ?

thanks

iangregsondev commented 10 years ago

Actually I notice that my profile calls the following profiles, but the context menu doesn't seem to be calling my profile which in turn should call the profiles below.

# Load posh-git example profile
. 'C:\tools\poshgit\dahlbyk-posh-git-95df787\profile.example.ps1'
if(Test-Path Function:\Prompt) {Rename-Item Function:\Prompt PrePoshHGPrompt -Force}
if(!(Test-Path function:\TabExpansion)) { New-Item function:\Global:TabExpansion -value '' | Out-Null }
# Load posh-hg example profile
. 'C:\ProgramData\chocolatey\lib\Posh-HG.1.1.0.20120528\JeremySkinner-posh-hg-2cabd74\profile.example.ps1'
Ehryk commented 9 years ago

I installed Posh-Git to try this out, and it is loading my profile (in my case, %USER_PROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1) - I even added echo "Profile Loaded." to the file and see this reported at an opened powershell prompt with my tools.

However, I suspect that by manually setting the prompt, as I do, I am excluding the Posh-Git elements from it. I have set up a branch, PowerShellProfileLoading for testing and development on this, and may experiment with ways to have a custom prompt with Posh-Git's extras.

Ehryk commented 9 years ago

I have pushed up a branch, DefaultPrompts, that does no overriding of the Prompt function (itself overridden by Posh-Git). This now loads the helpful git integration but loses the features I had put into the prompts.

At the moment I can't think of a slick way to have it both ways, but if you can come up with one or assist in having the prompt cake and eating it too then you are most certainly welcome to contribute :)

iangregsondev commented 9 years ago

Thanks. I downloaded the new branch. And right clicked on the inf found under C:\ContextMenuTools\Default Installs\SuperUser Install (Git, x64) (64 bit)

But the prompts seem to still contain the coloured additions etc and right clicking on a directory and choosing Powershell Cmdhere (Not the admin version) produces

[Window Title] Z:\back up

[Content] Z:\back up

Application not found

[OK]

iangregsondev commented 9 years ago

Right clicking the directory and choosing Powershell Cmd Here Adminitrator works.

But all the coloured directory enhancements are still present..

Ehryk commented 9 years ago

Ah, I found the issue. For cleaner formatting I was entering the registry keys with a space around escaped quotes, which it didn't like.

This now launches PowerShell, loads my profile (you can see the message I added), and does not interfere with PoshGit's prompt additions (see screenshot) when installed from the DefaultPrompts branch. Is this satisfactory to resolve the issue?

DefaultPrompts Branch - PoshGit