#Requires -Version 5.1 <# Windows-natives Pendant zu bootstrap/neovim-dict.sh. Laedt die deutschen Rechtschreib-Woerterbuecher fuer Neovim herunter. bootstrap/neovim-dict.sh bleibt unveraendert. Aufruf: .\bootstrap\neovim-dict-win.ps1 Falls die Ausfuehrung durch die Execution Policy blockiert wird: powershell -ExecutionPolicy Bypass -File .\bootstrap\neovim-dict-win.ps1 #> $ErrorActionPreference = "Stop" function Write-Ok($msg) { Write-Host "OK $msg" -ForegroundColor Green } function Write-Step($msg) { Write-Host "==> $msg" -ForegroundColor Cyan } function Write-SkipMsg($msg) { Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray } # Nativer Windows-Datenpfad von Neovim (kein XDG_DATA_HOME gesetzt): # $env:LOCALAPPDATA\nvim-data\site\spell $SpellDir = Join-Path $env:LOCALAPPDATA "nvim-data\site\spell" $Urls = @( "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl", "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" ) function Get-SpellFile([string]$Url) { $fileName = Split-Path -Leaf $Url $dest = Join-Path $SpellDir $fileName if (Test-Path $dest) { Write-SkipMsg $fileName return } Write-Step "Lade $fileName herunter" Invoke-WebRequest -Uri $Url -OutFile $dest Write-Ok $fileName } function Main { if (-not (Test-Path $SpellDir)) { New-Item -ItemType Directory -Path $SpellDir -Force | Out-Null } foreach ($url in $Urls) { Get-SpellFile $url } Write-Host "" Write-Host "Woerterbuecher fuer Neovim installiert!" -ForegroundColor Green } Main