Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
  2.  
  3. # Load posh-hg module from current directory
  4. #Import-Module .\posh-hg
  5.  
  6. # If module is installed in a default location ($env:PSModulePath),
  7. # use this instead (see about_Modules for more information):
  8. Import-Module posh-hg
  9.  
  10. # Set up a simple prompt, adding the hg prompt parts inside hg repos
  11. function prompt {
  12. Write-Host($pwd) -nonewline
  13.  
  14. # Mercurial Prompt
  15. $Global:HgStatus = Get-HgStatus
  16. Write-HgStatus $HgStatus
  17.  
  18. return "> "
  19. }
  20.  
  21. if(-not (Test-Path Function:\DefaultTabExpansion)) {
  22. Rename-Item Function:\TabExpansion DefaultTabExpansion
  23. }
  24.  
  25. # Set up tab expansion and include hg expansion
  26. function TabExpansion($line, $lastWord) {
  27. $lastBlock = [regex]::Split($line, '[|;]')[-1]
  28.  
  29. switch -regex ($lastBlock) {
  30. # mercurial and tortoisehg tab expansion
  31. '(hg|thg) (.*)' { HgTabExpansion($lastBlock) }
  32. # Fall back on existing tab expansion
  33. default { DefaultTabExpansion $line $lastWord }
  34. }
  35. }
  36.  
  37. Pop-Location
  38.  
  39. function Get-Batchfile ($file) {
  40. $cmd = "`"$file`" & set"
  41. cmd /c $cmd | Foreach-Object {
  42. $p, $v = $_.split('=')
  43. Set-Item -path env:$p -value $v
  44. }
  45. }
  46.  
  47. function VsVars32($version = "10.0")
  48. {
  49. if ([intptr]::size -eq 8)
  50. {
  51. $key = "HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio\" + $version
  52. }
  53. else
  54. {
  55. $key = "HKLM:SOFTWARE\Microsoft\VisualStudio\" + $version
  56. }
  57. $VsKey = get-ItemProperty $key
  58. $VsInstallPath = [System.IO.Path]::GetDirectoryName($VsKey.InstallDir)
  59. $VsToolsDir = [System.IO.Path]::GetDirectoryName($VsInstallPath)
  60. $VsToolsDir = [System.IO.Path]::Combine($VsToolsDir, "Tools")
  61. $BatchFile = [System.IO.Path]::Combine($VsToolsDir, "vsvars32.bat")
  62. Get-Batchfile $BatchFile
  63. [System.Console]::Title = "Visual Studio " + $version + " Windows Powershell"
  64. Set-ConsoleIcon "c:\users\eps\Documents\AwesomeVSIconsYouShouldNotHave\vspowershell.ico"
  65. }
  66.  
  67. Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
  68.  
  69. # DotSource the Console Icon Stuff
  70. . ./Set-ConsoleIcon.ps1
  71.  
  72. Pop-Location
Add Comment
Please, Sign In to add comment