mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-29 11:28:52 +08:00
Merge pull request #798 from JanSchulz/cmder_here
Make "cmder here" work again
This commit is contained in:
8
vendor/init.bat
vendored
8
vendor/init.bat
vendored
@ -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
29
vendor/profile.ps1
vendored
@ -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.
|
||||
|
Reference in New Issue
Block a user