Skip to content

Instantly share code, notes, and snippets.

@vongillern
Last active December 16, 2015 08:19
Show Gist options
  • Save vongillern/5404915 to your computer and use it in GitHub Desktop.
Save vongillern/5404915 to your computer and use it in GitHub Desktop.
It felt like the prompt line was getting really long (between a somewhat long directory, plus the inline status). So I modified my posh-git profile to put a linebreak after the path and git status. See screenshot here: http://pic.twitter.com/GSmZcWBtYQ
#profile.example.ps1
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current directory
Import-Module .\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 prompt {
$realLASTEXITCODE = $LASTEXITCODE
# Reset color, which can be messed up by Enable-GitColors
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
# ADDED - extra line so commands don't run together. Whitespace is nice.
Write-Host("")
Write-Host($pwd) -nonewline
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
# MODIFIED - Added linebreak after the path + git status
# See screenshot here: http://pic.twitter.com/GSmZcWBtYQ
return "
>> "
}
Enable-GitColors
Pop-Location
Start-SshAgent -Quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment