diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-07-23 11:20:49 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-07-23 11:20:49 +0200 |
| commit | b04598d71f18227af87cb04890b4dee5d38bd753 (patch) | |
| tree | 804549b2782e8dd05c5b78bf84364f050cf1e39c /bootstrap-win | |
| parent | 41ebdaff90a0b23262bf89c08444de20469c2232 (diff) | |
| download | dotfiles-b04598d71f18227af87cb04890b4dee5d38bd753.tar.gz dotfiles-b04598d71f18227af87cb04890b4dee5d38bd753.tar.bz2 dotfiles-b04598d71f18227af87cb04890b4dee5d38bd753.zip | |
windows: Bootstrap-Skripte nach bootstrap-win/ verschoben, -win-Suffix entfernt
bootstrap/neovim-win.ps1 -> bootstrap-win/neovim.ps1
bootstrap/neovim-dict-win.ps1 -> bootstrap-win/neovim-dict.ps1
Eigenes Verzeichnis statt Suffix pro Datei, analog zu windows/ fuer
gmake.cmd. bootstrap/ (POSIX, macOS/FreeBSD) bleibt unveraendert.
Referenzen in neovim-windows-setup.md aktualisiert.
Nebenbei: eine unerklaerte, nicht selbst vorgenommene Aenderung an
nvim/lua/config/treesitter.lua (fuegte 'powershell' zur Sprachliste
hinzu) verworfen statt versehentlich mit einzuchecken.
Diffstat (limited to 'bootstrap-win')
| -rw-r--r-- | bootstrap-win/neovim-dict.ps1 | 64 | ||||
| -rw-r--r-- | bootstrap-win/neovim.ps1 | 177 |
2 files changed, 241 insertions, 0 deletions
diff --git a/bootstrap-win/neovim-dict.ps1 b/bootstrap-win/neovim-dict.ps1 new file mode 100644 index 0000000..7909ffa --- /dev/null +++ b/bootstrap-win/neovim-dict.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-win\neovim-dict.ps1 | ||
| 9 | |||
| 10 | Falls die Ausfuehrung durch die Execution Policy blockiert wird: | ||
| 11 | powershell -ExecutionPolicy Bypass -File .\bootstrap-win\neovim-dict.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 | ||
diff --git a/bootstrap-win/neovim.ps1 b/bootstrap-win/neovim.ps1 new file mode 100644 index 0000000..548583e --- /dev/null +++ b/bootstrap-win/neovim.ps1 | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | #Requires -Version 5.1 | ||
| 2 | <# | ||
| 3 | Windows-natives Pendant zu bootstrap/neovim.sh (macOS/FreeBSD). | ||
| 4 | bootstrap/neovim.sh bleibt unveraendert - dieses Skript ist bewusst | ||
| 5 | eigenstaendig, da sich die Paketquellen (winget/npm statt brew/pkg) und | ||
| 6 | das Fehlerverhalten zu stark unterscheiden fuer ein gemeinsames Skript. | ||
| 7 | |||
| 8 | Nutzt ausschliesslich native Windows-Werkzeuge (winget, npm, pwsh/ | ||
| 9 | powershell.exe) - keine Git-Bash- oder WSL-Abhaengigkeit. | ||
| 10 | |||
| 11 | Aufruf (PowerShell, keine Admin-Rechte noetig): | ||
| 12 | .\bootstrap-win\neovim.ps1 | ||
| 13 | |||
| 14 | Hinweis: Einzelne winget-Paket-IDs (v.a. GnuWin32.Gawk, GnuWin32.Libxml2, | ||
| 15 | google.yamlfmt, mvdan.shfmt, astral-sh.ruff) konnten in dieser Session | ||
| 16 | nicht gegen eine aktuelle winget-Quelle verifiziert werden. Schlaegt eine | ||
| 17 | Installation fehl, meldet das Skript das als Warnung (bricht nicht ab) | ||
| 18 | und nennt den Befehl zum manuellen Nachschlagen ("winget search <name>"). | ||
| 19 | |||
| 20 | C-Compiler fuer nvim-treesitter: kein winget-Paket enthalten, da MSVC auf | ||
| 21 | den Zielsystemen bereits vorhanden ist. Neovim muss dafuer aus einer | ||
| 22 | "Developer PowerShell for VS" gestartet werden (siehe Install-Tools). | ||
| 23 | #> | ||
| 24 | |||
| 25 | $ErrorActionPreference = "Stop" | ||
| 26 | $script:Failures = @() | ||
| 27 | |||
| 28 | function Write-Ok($msg) { | ||
| 29 | Write-Host "OK $msg" -ForegroundColor Green | ||
| 30 | } | ||
| 31 | |||
| 32 | function Write-Step($msg) { | ||
| 33 | Write-Host "==> $msg" -ForegroundColor Cyan | ||
| 34 | } | ||
| 35 | |||
| 36 | function Write-Skip($msg) { | ||
| 37 | Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray | ||
| 38 | } | ||
| 39 | |||
| 40 | function Write-Warn($msg) { | ||
| 41 | Write-Host "! $msg" -ForegroundColor Yellow | ||
| 42 | $script:Failures += $msg | ||
| 43 | } | ||
| 44 | |||
| 45 | function Test-CommandExists([string]$Name) { | ||
| 46 | return [bool](Get-Command $Name -ErrorAction SilentlyContinue) | ||
| 47 | } | ||
| 48 | |||
| 49 | function Install-WingetPackage([string]$Binary, [string]$Id) { | ||
| 50 | if (Test-CommandExists $Binary) { | ||
| 51 | Write-Skip $Binary | ||
| 52 | return | ||
| 53 | } | ||
| 54 | |||
| 55 | Write-Step "winget install $Id" | ||
| 56 | winget install --id $Id -e --source winget --accept-package-agreements --accept-source-agreements --silent | Out-Null | ||
| 57 | |||
| 58 | if ($LASTEXITCODE -ne 0) { | ||
| 59 | Write-Warn "winget install $Id fehlgeschlagen (Binary '$Binary' nicht gefunden). Pruefen mit: winget search $Id" | ||
| 60 | return | ||
| 61 | } | ||
| 62 | |||
| 63 | Write-Ok $Id | ||
| 64 | } | ||
| 65 | |||
| 66 | function Install-NpmPackage([string]$Binary, [string]$Package) { | ||
| 67 | if (Test-CommandExists $Binary) { | ||
| 68 | Write-Skip $Binary | ||
| 69 | return | ||
| 70 | } | ||
| 71 | |||
| 72 | if (-not (Test-CommandExists "npm")) { | ||
| 73 | Write-Warn "npm wurde nicht gefunden - kann '$Package' nicht installieren." | ||
| 74 | return | ||
| 75 | } | ||
| 76 | |||
| 77 | Write-Step "npm install -g $Package" | ||
| 78 | npm install -g $Package | Out-Null | ||
| 79 | |||
| 80 | if ($LASTEXITCODE -ne 0) { | ||
| 81 | Write-Warn "npm install -g $Package fehlgeschlagen." | ||
| 82 | return | ||
| 83 | } | ||
| 84 | |||
| 85 | Write-Ok $Package | ||
| 86 | } | ||
| 87 | |||
| 88 | function Test-Prerequisites { | ||
| 89 | if (-not (Test-CommandExists "winget")) { | ||
| 90 | Write-Host "Fehler: winget wurde nicht gefunden. 'App Installer' aus dem Microsoft Store installieren." -ForegroundColor Red | ||
| 91 | exit 1 | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | function Update-SessionPath { | ||
| 96 | # winget/npm-Installer tragen PATH-Aenderungen in die Registry (User- | ||
| 97 | # und/oder Machine-Scope) ein, aber der laufende PowerShell-Prozess | ||
| 98 | # bekommt das nicht automatisch mit. Ohne diesen Refresh wuerde z.B. | ||
| 99 | # "npm" gleich im Anschluss an die Node-Installation als "nicht | ||
| 100 | # gefunden" gemeldet, obwohl es gerade erst installiert wurde. | ||
| 101 | $machine = [Environment]::GetEnvironmentVariable("PATH", "Machine") | ||
| 102 | $user = [Environment]::GetEnvironmentVariable("PATH", "User") | ||
| 103 | $env:PATH = "$machine;$user" | ||
| 104 | } | ||
| 105 | |||
| 106 | function Install-Prerequisites { | ||
| 107 | Install-WingetPackage -Binary "git" -Id "Git.Git" | ||
| 108 | Install-WingetPackage -Binary "node" -Id "OpenJS.NodeJS.LTS" | ||
| 109 | Update-SessionPath | ||
| 110 | } | ||
| 111 | |||
| 112 | function Install-Formatters { | ||
| 113 | Install-WingetPackage -Binary "jq" -Id "jqlang.jq" | ||
| 114 | Install-NpmPackage -Binary "prettier" -Package "prettier" | ||
| 115 | Install-WingetPackage -Binary "ruff" -Id "astral-sh.ruff" | ||
| 116 | Install-WingetPackage -Binary "shfmt" -Id "mvdan.shfmt" | ||
| 117 | Install-WingetPackage -Binary "stylua" -Id "JohnnyMorganz.StyLua" | ||
| 118 | Install-WingetPackage -Binary "yamlfmt" -Id "google.yamlfmt" | ||
| 119 | Install-WingetPackage -Binary "gawk" -Id "GnuWin32.Gawk" | ||
| 120 | Install-WingetPackage -Binary "xmllint" -Id "GnuWin32.Libxml2" | ||
| 121 | } | ||
| 122 | |||
| 123 | function Install-Tools { | ||
| 124 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" | ||
| 125 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" | ||
| 126 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" | ||
| 127 | |||
| 128 | # C-Compiler fuer nvim-treesitter: kein winget-Paket noetig, MSVC (cl.exe) | ||
| 129 | # ist auf diesen Systemen bereits vorhanden. nvim-treesitter findet cl.exe | ||
| 130 | # automatisch, ABER nur wenn INCLUDE/LIB gesetzt sind - das passiert nicht | ||
| 131 | # in einer normalen PowerShell, sondern nur in einer "Developer PowerShell | ||
| 132 | # for VS" bzw. "x64 Native Tools Command Prompt". Neovim also immer aus | ||
| 133 | # so einer Shell heraus starten, sonst schlaegt die Parser-Kompilierung | ||
| 134 | # mit "cannot find <header>.h" o.ae. fehl, obwohl cl.exe selbst gefunden wird. | ||
| 135 | |||
| 136 | # opt.makeprg = "gmake" (nvim/lua/config/options.lua) - Alias liegt in | ||
| 137 | # windows/bin/gmake.cmd, reicht an "make" durch. Einmalig windows\bin | ||
| 138 | # zum PATH hinzufuegen (PowerShell, User-Scope, nicht setx mit %PATH% | ||
| 139 | # verwenden - das wuerde den gesamten Prozess-PATH inkl. System-Anteil | ||
| 140 | # dauerhaft in den User-PATH kopieren): | ||
| 141 | # $userPath = [Environment]::GetEnvironmentVariable("PATH", "User") | ||
| 142 | # [Environment]::SetEnvironmentVariable("PATH", "$userPath;$env:USERPROFILE\dotfiles\windows\bin", "User") | ||
| 143 | Install-WingetPackage -Binary "make" -Id "GnuWin32.Make" | ||
| 144 | } | ||
| 145 | |||
| 146 | function Install-Lsp { | ||
| 147 | Install-NpmPackage -Binary "basedpyright-langserver" -Package "basedpyright" | ||
| 148 | Install-NpmPackage -Binary "bash-language-server" -Package "bash-language-server" | ||
| 149 | Install-WingetPackage -Binary "clangd" -Id "LLVM.LLVM" | ||
| 150 | Install-WingetPackage -Binary "shellcheck" -Id "koalaman.shellcheck" | ||
| 151 | Install-NpmPackage -Binary "vscode-html-language-server" -Package "vscode-langservers-extracted" | ||
| 152 | Install-NpmPackage -Binary "vscode-json-language-server" -Package "vscode-langservers-extracted" | ||
| 153 | Install-WingetPackage -Binary "lua-language-server" -Id "LuaLS.lua-language-server" | ||
| 154 | Install-NpmPackage -Binary "prisma-language-server" -Package "@prisma/language-server" | ||
| 155 | Install-NpmPackage -Binary "vtsls" -Package "@vtsls/language-server" | ||
| 156 | } | ||
| 157 | |||
| 158 | function Main { | ||
| 159 | Test-Prerequisites | ||
| 160 | |||
| 161 | Install-Prerequisites | ||
| 162 | Install-Formatters | ||
| 163 | Install-Tools | ||
| 164 | Install-Lsp | ||
| 165 | |||
| 166 | Write-Host "" | ||
| 167 | if ($script:Failures.Count -eq 0) { | ||
| 168 | Write-Host "Bootstrap abgeschlossen." -ForegroundColor Green | ||
| 169 | } else { | ||
| 170 | Write-Host "Bootstrap abgeschlossen, mit $($script:Failures.Count) Warnung(en):" -ForegroundColor Yellow | ||
| 171 | foreach ($f in $script:Failures) { | ||
| 172 | Write-Host " - $f" -ForegroundColor Yellow | ||
| 173 | } | ||
| 174 | } | ||
| 175 | } | ||
| 176 | |||
| 177 | Main | ||
