Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
94 lines (82 loc) · 3.41 KB
/
Copy pathinstall.ps1
File metadata and controls
94 lines (82 loc) · 3.41 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# NvPak Professional Installer (Windows Zen Edition)
#Requires -Version 5.1
$ErrorActionPreference = 'Stop'
$Repo = if ($env:NVPAK_REPO) { $env:NVPAK_REPO } else { "https://github.com/EvolveBeyond/NvPak.git" }
$ConfigDir = Join-Path $env:LOCALAPPDATA "nvim"
function Confirm ($msg) {
$choice = Read-Host "question $msg [y/N]"
return $choice -eq 'y'
}
function Invoke-NvimBootstrap {
# Runs `nvim --headless "+Rocks sync" "+qa"` with a 120s timeout.
# Returns $true on exit code 0, $false otherwise (timeout or failure).
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = (Get-Command nvim).Source
$psi.Arguments = '--headless "+Rocks sync" "+qa"'
$psi.UseShellExecute = $false
$psi.CreateNoWindow = $true
$proc = [System.Diagnostics.Process]::Start($psi)
if (-not $proc.WaitForExit(120000)) {
try { $proc.Kill() } catch {}
return $false
}
return ($proc.ExitCode -eq 0)
}
Clear-Host
Write-Host "NvPak Professional Installer (Zen Edition)`n" -ForegroundColor Magenta
if (-not (Get-Command scoop -ErrorAction SilentlyContinue)) {
if (Confirm "Scoop not found. Install it?") {
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Invoke-RestMethod -Uri get.scoop.sh | Invoke-Expression
} else {
Write-Host "warn Skipping Scoop. Ensure dependencies are installed manually." -ForegroundColor Yellow
}
}
if (Get-Command scoop -ErrorAction SilentlyContinue) {
Write-Host "info Installing dependencies via Scoop..." -ForegroundColor Blue
scoop install git neovim ripgrep fd 7zip win32yank -s
if ($LASTEXITCODE -ne 0) {
Write-Host "info Some packages already present or install reported issues." -ForegroundColor Blue
}
}
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "error Git is required but not installed. Aborting." -ForegroundColor Red
exit 1
}
if (Test-Path $ConfigDir) {
if (Test-Path (Join-Path $ConfigDir ".git")) {
Write-Host "info Updating NvPak..." -ForegroundColor Blue
git -C $ConfigDir pull
if ($LASTEXITCODE -ne 0) {
Write-Host "warn Update failed. Continuing with existing config." -ForegroundColor Yellow
}
} else {
if (Confirm "Non-git directory found at $ConfigDir. Backup and re-clone?") {
Rename-Item $ConfigDir "$ConfigDir.bak.$([DateTimeOffset]::Now.ToUnixTimeSeconds())"
git clone --depth 1 $Repo $ConfigDir
if ($LASTEXITCODE -ne 0) {
Write-Host "error Clone failed." -ForegroundColor Red
exit 1
}
} else {
Write-Host "error Installation aborted by user." -ForegroundColor Red
exit 1
}
}
} else {
Write-Host "info Cloning NvPak..." -ForegroundColor Blue
git clone --depth 1 $Repo $ConfigDir
if ($LASTEXITCODE -ne 0) {
Write-Host "error Clone failed." -ForegroundColor Red
exit 1
}
}
if (-not (Get-Command nvim -ErrorAction SilentlyContinue)) {
Write-Host "error Neovim (nvim) is required but not installed. Aborting." -ForegroundColor Red
exit 1
}
Write-Host "info Bootstrapping plugins (120s timeout)..." -ForegroundColor Blue
if (-not (Invoke-NvimBootstrap)) {
Write-Host "warn Plugin bootstrap had issues. Run ':Rocks sync' manually." -ForegroundColor Yellow
}
Write-Host "success NvPak installation complete!" -ForegroundColor Green