-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_neovim.ps1
executable file
·77 lines (24 loc) · 1.15 KB
/
windows_neovim.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$ErrorActionPreference = "Stop"
Function New-TempFolder
{
$TEMPFILE = New-TemporaryFile
Remove-Item -Force $TEMPFILE
return Join-Path $env:TEMP $TEMPFILE.Name
}
$DownloadLoc = New-TemporaryFile
$RenamedFile = $DownloadLoc.BaseName + ".zip"
$ExtractFolder = New-TempFolder
$OutputFolder = Join-Path $HOME "neovim"
$BinFolder = Join-Path "$OutputFolder" "bin"
Invoke-WebRequest "https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip" -OutFile $DownloadLoc
Write-Output "Downloading neovim"
Rename-Item $DownloadLoc $RenamedFile
Expand-Archive -Path "$(Join-Path $DownloadLoc.Directory $RenamedFile)" -DestinationPath $ExtractFolder
Remove-Item -Recurse -Force $OutputFolder
Copy-Item -Recurse -Force -Path "$ExtractFolder\Neovim" -Destination $OutputFolder
$UserPath = [Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)
if (!$UserPath.Split(";").Contains($BinFolder))
{
Write-Output Updating Path
[Environment]::SetEnvironmentVariable("Path","$UserPath;$BinFolder",[System.EnvironmentVariableTarget]::User)
}