2015-03-18 23:33:55 +08:00
|
|
|
|
# Add Cmder modules directory to the autoload path.
|
|
|
|
|
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
|
2014-09-17 15:55:15 +08:00
|
|
|
|
|
2015-03-18 23:33:55 +08:00
|
|
|
|
if( -not $env:PSModulePath.Contains($CmderModulePath) ){
|
|
|
|
|
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
2014-09-17 15:55:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Set up a Cmder prompt, adding the git prompt parts inside git repos
|
|
|
|
|
function global:prompt {
|
|
|
|
|
$realLASTEXITCODE = $LASTEXITCODE
|
2014-09-17 21:07:34 +08:00
|
|
|
|
$Host.UI.RawUI.ForegroundColor = "White"
|
2015-03-18 23:47:01 +08:00
|
|
|
|
Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
|
2014-09-17 15:55:15 +08:00
|
|
|
|
if (Get-Module posh-git) {
|
|
|
|
|
Write-VcsStatus
|
|
|
|
|
}
|
|
|
|
|
$global:LASTEXITCODE = $realLASTEXITCODE
|
2014-10-29 04:25:25 +08:00
|
|
|
|
Write-Host "`nλ" -NoNewLine -ForegroundColor "DarkGray"
|
|
|
|
|
return " "
|
2014-09-17 15:55:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Load special features come from posh-git
|
|
|
|
|
if (Get-Module posh-git) {
|
|
|
|
|
Enable-GitColors
|
|
|
|
|
Start-SshAgent -Quiet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Move to the wanted location
|
|
|
|
|
if (Test-Path Env:\CMDER_START) {
|
|
|
|
|
Set-Location -Path $Env:CMDER_START
|
|
|
|
|
} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {
|
|
|
|
|
Set-Location -Path $Env:USERPROFILE
|
|
|
|
|
}
|