Skip to content

Instantly share code, notes, and snippets.

@phuf
Created January 7, 2017 02:18
Show Gist options
  • Save phuf/5203e401d01a4a4e5cd92ee7ca677332 to your computer and use it in GitHub Desktop.
Save phuf/5203e401d01a4a4e5cd92ee7ca677332 to your computer and use it in GitHub Desktop.
Install VIM on Windows Server Core
Set-ExecutionPolicy Unrestricted;
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression;
choco install vim
choco update vim
$command = (Get-itemProperty -LiteralPath "HKLM:\SOFTWARE\Classes\`*\shell\Vim\Command").'(default)';
if ($command -match "`"([^`"]+)`".*") {
$expression = "Set-Alias -Name 'vim' -Value '$($Matches[1])';"
if (-Not (Test-Path "$PROFILE")) {
"$expression`r`n" | Out-File -FilePath "$PROFILE" -Encoding UTF8;
} elseif (Get-Content "$PROFILE" | Where-Object { $_ -eq "$expression" } ) {
Add-Content '$PROFILE' "`r`n$expression`r`n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment