Merge pull request #798 from JanSchulz/cmder_here

Make "cmder here" work again
This commit is contained in:
Martin Kemp
2016-01-15 11:44:39 +00:00
3 changed files with 14 additions and 37 deletions

8
vendor/init.bat vendored
View File

@ -58,7 +58,7 @@
@if not exist "%CMDER_ROOT%\config\aliases" (
echo Creating intial aliases in %CMDER_ROOT%\config\aliases
copy "%CMDER_ROOT%\vendor\aliases.example" "%CMDER_ROOT%\config\aliases" > null
)
)
:: Add aliases
@doskey /macrofile="%CMDER_ROOT%\config\aliases"
@ -76,12 +76,10 @@
:: Set home path
@if not defined HOME set HOME=%USERPROFILE%
:: This is either a env variable set by the user or the result of
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
@if defined CMDER_START (
@cd /d "%CMDER_START%"
) else (
@if "%CD%\" == "%CMDER_ROOT%\" (
@cd /d "%HOME%"
)
)
@if exist "%CMDER_ROOT%\config\user-profile.cmd" (

29
vendor/profile.ps1 vendored
View File

@ -32,7 +32,7 @@ try {
# $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\usr\bin")
# set-alias -name "vi" -value "vim"
# # I think the below is safer.
new-alias -name "vim" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe")
new-alias -name "vi" -value vim
}
@ -82,34 +82,15 @@ if ($gitStatus) {
}
# Move to the wanted location
$cmderStartKey = 'HKCU:\Software\cmder'
$cmderStartSubKey = 'CMDER_START'
$cmderStart = (Get-Item -Path $cmderStartKey -ErrorAction SilentlyContinue)
if ( $cmderStart ) {
$cmderStart = $cmderStart.GetValue($cmderStartSubKey)
$cmderStart = ($cmderStart).Trim('"').Trim("'")
if ( $cmderStart.EndsWith(':') ) {
$cmderStart += '\'
}
if ( ( Get-Item $cmderStart -Force ) -is [System.IO.FileInfo] ) {
$cmderStart = Split-Path $cmderStart
}
Set-Location -Path "${cmderStart}"
Set-ItemProperty -Path $cmderStartKey -Name $cmderStartSubKey -Value $null
} else {
Set-Location -Path "${env:HOME}"
# This is either a env variable set by the user or the result of
# cmder.exe setting this variable due to a commandline argument or a "cmder here"
if ( $ENV:CMDER_START ) {
Set-Location -Path "$ENV:CMDER_START"
}
# Enhance Path
$env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user-profile.ps1"
if(Test-Path $CmderUserProfilePath) {
# Create this file and place your own command in there.