diff options
Diffstat (limited to 'bootstrap/neovim-dict-win.ps1')
| -rw-r--r-- | bootstrap/neovim-dict-win.ps1 | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/bootstrap/neovim-dict-win.ps1 b/bootstrap/neovim-dict-win.ps1 new file mode 100644 index 0000000..6c0c710 --- /dev/null +++ b/bootstrap/neovim-dict-win.ps1 | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #Requires -Version 5.1 | ||
| 2 | <# | ||
| 3 | Windows-natives Pendant zu bootstrap/neovim-dict.sh. | ||
| 4 | Laedt die deutschen Rechtschreib-Woerterbuecher fuer Neovim herunter. | ||
| 5 | bootstrap/neovim-dict.sh bleibt unveraendert. | ||
| 6 | |||
| 7 | Aufruf: | ||
| 8 | .\bootstrap\neovim-dict-win.ps1 | ||
| 9 | |||
| 10 | Falls die Ausfuehrung durch die Execution Policy blockiert wird: | ||
| 11 | powershell -ExecutionPolicy Bypass -File .\bootstrap\neovim-dict-win.ps1 | ||
| 12 | #> | ||
| 13 | |||
| 14 | $ErrorActionPreference = "Stop" | ||
| 15 | |||
| 16 | function Write-Ok($msg) { | ||
| 17 | Write-Host "OK $msg" -ForegroundColor Green | ||
| 18 | } | ||
| 19 | |||
| 20 | function Write-Step($msg) { | ||
| 21 | Write-Host "==> $msg" -ForegroundColor Cyan | ||
| 22 | } | ||
| 23 | |||
| 24 | function Write-SkipMsg($msg) { | ||
| 25 | Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray | ||
| 26 | } | ||
| 27 | |||
| 28 | # Nativer Windows-Datenpfad von Neovim (kein XDG_DATA_HOME gesetzt): | ||
| 29 | # $env:LOCALAPPDATA\nvim-data\site\spell | ||
| 30 | $SpellDir = Join-Path $env:LOCALAPPDATA "nvim-data\site\spell" | ||
| 31 | |||
| 32 | $Urls = @( | ||
| 33 | "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.spl", | ||
| 34 | "https://ftp.nluug.nl/pub/vim/runtime/spell/de.utf-8.sug" | ||
| 35 | ) | ||
| 36 | |||
| 37 | function Get-SpellFile([string]$Url) { | ||
| 38 | $fileName = Split-Path -Leaf $Url | ||
| 39 | $dest = Join-Path $SpellDir $fileName | ||
| 40 | |||
| 41 | if (Test-Path $dest) { | ||
| 42 | Write-SkipMsg $fileName | ||
| 43 | return | ||
| 44 | } | ||
| 45 | |||
| 46 | Write-Step "Lade $fileName herunter" | ||
| 47 | Invoke-WebRequest -Uri $Url -OutFile $dest | ||
| 48 | Write-Ok $fileName | ||
| 49 | } | ||
| 50 | |||
| 51 | function Main { | ||
| 52 | if (-not (Test-Path $SpellDir)) { | ||
| 53 | New-Item -ItemType Directory -Path $SpellDir -Force | Out-Null | ||
| 54 | } | ||
| 55 | |||
| 56 | foreach ($url in $Urls) { | ||
| 57 | Get-SpellFile $url | ||
| 58 | } | ||
| 59 | |||
| 60 | Write-Host "" | ||
| 61 | Write-Host "Woerterbuecher fuer Neovim installiert!" -ForegroundColor Green | ||
| 62 | } | ||
| 63 | |||
| 64 | Main | ||
