Skip to content

Instantly share code, notes, and snippets.

@crejb
Created February 13, 2017 03:43
Show Gist options
  • Save crejb/6efcc5207324d9246f72cd88cd9400de to your computer and use it in GitHub Desktop.
Save crejb/6efcc5207324d9246f72cd88cd9400de to your computer and use it in GitHub Desktop.
Powershell Profile
# C:\Users\[username]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current directory
Import-Module -Name posh-git
# If module is installed in a default location ($env:PSModulePath),
# use this instead (see about_Modules for more information):
# Import-Module posh-git
# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
Write-Host($pwd.ProviderPath) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return "> "
}
Pop-Location
Start-SshAgent -Quiet
# If not opening powershell from a specific directory, use c:\src as the default
if((Get-Location).Path -eq $home){
Set-Location C:\src
}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment