From 8566b6f6caa693814c5d3119a1910f409dcddef1 Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Mon, 23 Nov 2015 19:10:22 -0500 Subject: [PATCH] Added vi/vim aliases and fixed powershell startup errors --- config/aliases | 1 + vendor/profile.ps1 | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/aliases b/config/aliases index 41d71ad..c726204 100644 --- a/config/aliases +++ b/config/aliases @@ -5,3 +5,4 @@ pwd=cd clear=cls history=cat %CMDER_ROOT%\config\.history unalias=alias /d $1 +vi=vim $* diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index ba9422e..134e4d9 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -27,7 +27,14 @@ if( -not $env:PSModulePath.Contains($CmderModulePath) ){ try { Get-command -Name "vim" -ErrorAction Stop >$null } catch { - $env:Path += ";$env:CMDER_ROOT\vendor\git-for-windows\usr\share\vim\vim74" + # # You could do this but it may be a little drastic and introduce a lot of + # # unix tool overlap with powershel unix like aliases + # $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\usr\bin") + # set-alias -name "vi" -value "vim" + # # I think the below is safer. + set-alias -name "vim" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe $1 $2 $3 $4 $5 $6 $7 $8 $9") + set-alias -name "vi" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe $1 $2 $3 $4 $5 $6 $7 $8 $9") + } try { @@ -78,8 +85,10 @@ if ($gitStatus) { $cmderStartKey = 'HKCU:\Software\cmder' $cmderStartSubKey = 'CMDER_START' -$cmderStart = (Get-Item -Path $cmderStartKey).GetValue($cmderStartSubKey) +$cmderStart = (Get-Item -Path $cmderStartKey -ErrorAction SilentlyContinue) + if ( $cmderStart ) { + $cmderStart = $cmderStart.GetValue($cmderStartSubKey) $cmderStart = ($cmderStart).Trim('"').Trim("'") if ( $cmderStart.EndsWith(':') ) { $cmderStart += '\' @@ -96,6 +105,7 @@ if ( $cmderStart ) { Set-Location -Path "${env:HOME}" } + # Enhance Path $env:Path = "$Env:CMDER_ROOT\bin;$env:Path;$Env:CMDER_ROOT"