mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-15 08:19:10 +08:00
e9300ca43f
The start directory of cmder is defined in that order: 1. The directory passed as parameter to the cmder executable 2. The `CMDER_START` environment variable 3. The `HOME` environment variable 4. The current user directory (`USERPROFILE` environment variable) This commit also fix two issues: * stating cmder with a path in parameter would set CMDER_START (whereas it may just be temporary) * fix new line in cmd when starting cmder (this one was buggin me)
33 lines
825 B
PowerShell
33 lines
825 B
PowerShell
# Global modules directory
|
|
$global:PsGetDestinationModulePath = $PSScriptRoot + "\..\vendor\psmodules"
|
|
|
|
# Push to modules location
|
|
Push-Location -Path ($PsGetDestinationModulePath)
|
|
|
|
# Load modules from current directory
|
|
Get-ChildItem -Directory | `
|
|
Foreach-Object{
|
|
Import-Module .\$_\$_
|
|
}
|
|
|
|
# Come back to PWD
|
|
Pop-Location
|
|
|
|
# Set up a Cmder prompt, adding the git prompt parts inside git repos
|
|
function global:prompt {
|
|
$realLASTEXITCODE = $LASTEXITCODE
|
|
$Host.UI.RawUI.ForegroundColor = "white"
|
|
Write-Host($pwd.ProviderPath) -NoNewLine -ForegroundColor "green"
|
|
if (Get-Module posh-git) {
|
|
Write-VcsStatus
|
|
}
|
|
$global:LASTEXITCODE = $realLASTEXITCODE
|
|
return "`nλ "
|
|
}
|
|
|
|
# Load special features come from posh-git
|
|
if (Get-Module posh-git) {
|
|
Enable-GitColors
|
|
Start-SshAgent -Quiet
|
|
}
|