Created
January 7, 2017 02:18
-
-
Save phuf/5203e401d01a4a4e5cd92ee7ca677332 to your computer and use it in GitHub Desktop.
Install VIM on Windows Server Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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