diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-07-23 09:51:55 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-07-23 09:51:55 +0200 |
| commit | fe4db25063224c51f9970f2f41d355f60d751b1b (patch) | |
| tree | 04852c80566b91e70a7ece10f51030e763751672 | |
| parent | 1b2066ee60e9fc629941db716d8a7ac6d81dbca6 (diff) | |
| download | dotfiles-fe4db25063224c51f9970f2f41d355f60d751b1b.tar.gz dotfiles-fe4db25063224c51f9970f2f41d355f60d751b1b.tar.bz2 dotfiles-fe4db25063224c51f9970f2f41d355f60d751b1b.zip | |
bootstrap: neovim-win.ps1 hinzugefuegt (natives PowerShell-Pendant)
Reiner PowerShell-Weg statt Git-Bash/WSL, wie von Thomas gewuenscht.
Installiert Formatter/Tools/LSP-Server per winget und npm; einzelne
fehlschlagende Pakete werden als Warnung gemeldet statt das Skript
abzubrechen (mehrere winget-IDs konnten in dieser Session nicht gegen
eine Live-Quelle verifiziert werden, siehe Kopfkommentar im Skript).
neovim-windows-setup.md: Abschnitt zu externen Abhaengigkeiten auf das
neue Skript verweisen lassen statt einzelne Befehle aufzulisten.
| -rw-r--r-- | bootstrap/neovim-win.ps1 | 154 | ||||
| -rw-r--r-- | neovim-windows-setup.md | 43 |
2 files changed, 158 insertions, 39 deletions
diff --git a/bootstrap/neovim-win.ps1 b/bootstrap/neovim-win.ps1 new file mode 100644 index 0000000..60ed0ea --- /dev/null +++ b/bootstrap/neovim-win.ps1 | |||
| @@ -0,0 +1,154 @@ | |||
| 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\neovim-win.ps1 | ||
| 13 | |||
| 14 | Hinweis: Einzelne winget-Paket-IDs (v.a. GnuWin32.Gawk, GnuWin32.Libxml2, | ||
| 15 | google.yamlfmt, mvdan.shfmt, astral-sh.ruff, zig.zig) konnten in dieser | ||
| 16 | Session nicht gegen eine aktuelle winget-Quelle verifiziert werden. | ||
| 17 | Schlaegt eine Installation fehl, meldet das Skript das als Warnung | ||
| 18 | (bricht nicht ab) und nennt den Befehl zum manuellen Nachschlagen | ||
| 19 | ("winget search <name>"). | ||
| 20 | #> | ||
| 21 | |||
| 22 | $ErrorActionPreference = "Stop" | ||
| 23 | $script:Failures = @() | ||
| 24 | |||
| 25 | function Write-Ok($msg) { | ||
| 26 | Write-Host "OK $msg" -ForegroundColor Green | ||
| 27 | } | ||
| 28 | |||
| 29 | function Write-Step($msg) { | ||
| 30 | Write-Host "==> $msg" -ForegroundColor Cyan | ||
| 31 | } | ||
| 32 | |||
| 33 | function Write-Skip($msg) { | ||
| 34 | Write-Host "- $msg bereits vorhanden" -ForegroundColor DarkGray | ||
| 35 | } | ||
| 36 | |||
| 37 | function Write-Warn($msg) { | ||
| 38 | Write-Host "! $msg" -ForegroundColor Yellow | ||
| 39 | $script:Failures += $msg | ||
| 40 | } | ||
| 41 | |||
| 42 | function Test-CommandExists([string]$Name) { | ||
| 43 | return [bool](Get-Command $Name -ErrorAction SilentlyContinue) | ||
| 44 | } | ||
| 45 | |||
| 46 | function Install-WingetPackage([string]$Binary, [string]$Id) { | ||
| 47 | if (Test-CommandExists $Binary) { | ||
| 48 | Write-Skip $Binary | ||
| 49 | return | ||
| 50 | } | ||
| 51 | |||
| 52 | Write-Step "winget install $Id" | ||
| 53 | winget install --id $Id -e --source winget --accept-package-agreements --accept-source-agreements --silent | Out-Null | ||
| 54 | |||
| 55 | if ($LASTEXITCODE -ne 0) { | ||
| 56 | Write-Warn "winget install $Id fehlgeschlagen (Binary '$Binary' nicht gefunden). Pruefen mit: winget search $Id" | ||
| 57 | return | ||
| 58 | } | ||
| 59 | |||
| 60 | Write-Ok $Id | ||
| 61 | } | ||
| 62 | |||
| 63 | function Install-NpmPackage([string]$Binary, [string]$Package) { | ||
| 64 | if (Test-CommandExists $Binary) { | ||
| 65 | Write-Skip $Binary | ||
| 66 | return | ||
| 67 | } | ||
| 68 | |||
| 69 | if (-not (Test-CommandExists "npm")) { | ||
| 70 | Write-Warn "npm wurde nicht gefunden - kann '$Package' nicht installieren." | ||
| 71 | return | ||
| 72 | } | ||
| 73 | |||
| 74 | Write-Step "npm install -g $Package" | ||
| 75 | npm install -g $Package | Out-Null | ||
| 76 | |||
| 77 | if ($LASTEXITCODE -ne 0) { | ||
| 78 | Write-Warn "npm install -g $Package fehlgeschlagen." | ||
| 79 | return | ||
| 80 | } | ||
| 81 | |||
| 82 | Write-Ok $Package | ||
| 83 | } | ||
| 84 | |||
| 85 | function Test-Prerequisites { | ||
| 86 | if (-not (Test-CommandExists "winget")) { | ||
| 87 | Write-Host "Fehler: winget wurde nicht gefunden. 'App Installer' aus dem Microsoft Store installieren." -ForegroundColor Red | ||
| 88 | exit 1 | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | function Install-Prerequisites { | ||
| 93 | Install-WingetPackage -Binary "git" -Id "Git.Git" | ||
| 94 | Install-WingetPackage -Binary "node" -Id "OpenJS.NodeJS.LTS" | ||
| 95 | } | ||
| 96 | |||
| 97 | function Install-Formatters { | ||
| 98 | Install-WingetPackage -Binary "jq" -Id "jqlang.jq" | ||
| 99 | Install-NpmPackage -Binary "prettier" -Package "prettier" | ||
| 100 | Install-WingetPackage -Binary "ruff" -Id "astral-sh.ruff" | ||
| 101 | Install-WingetPackage -Binary "shfmt" -Id "mvdan.shfmt" | ||
| 102 | Install-WingetPackage -Binary "stylua" -Id "JohnnyMorganz.StyLua" | ||
| 103 | Install-WingetPackage -Binary "yamlfmt" -Id "google.yamlfmt" | ||
| 104 | Install-WingetPackage -Binary "gawk" -Id "GnuWin32.Gawk" | ||
| 105 | Install-WingetPackage -Binary "xmllint" -Id "GnuWin32.Libxml2" | ||
| 106 | } | ||
| 107 | |||
| 108 | function Install-Tools { | ||
| 109 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" | ||
| 110 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" | ||
| 111 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" | ||
| 112 | |||
| 113 | # C-Compiler, damit nvim-treesitter Parser kompilieren kann. | ||
| 114 | Install-WingetPackage -Binary "zig" -Id "zig.zig" | ||
| 115 | |||
| 116 | # opt.makeprg = "gmake" (nvim/lua/config/options.lua) - Alias liegt in | ||
| 117 | # windows/bin/gmake.cmd, reicht an "make" durch. Einmalig windows\bin | ||
| 118 | # zum PATH hinzufuegen, z.B.: | ||
| 119 | # setx PATH "%PATH%;%USERPROFILE%\dotfiles\windows\bin" | ||
| 120 | Install-WingetPackage -Binary "make" -Id "GnuWin32.Make" | ||
| 121 | } | ||
| 122 | |||
| 123 | function Install-Lsp { | ||
| 124 | Install-NpmPackage -Binary "basedpyright-langserver" -Package "basedpyright" | ||
| 125 | Install-NpmPackage -Binary "bash-language-server" -Package "bash-language-server" | ||
| 126 | Install-WingetPackage -Binary "clangd" -Id "LLVM.LLVM" | ||
| 127 | Install-WingetPackage -Binary "shellcheck" -Id "koalaman.shellcheck" | ||
| 128 | Install-NpmPackage -Binary "vscode-html-language-server" -Package "vscode-langservers-extracted" | ||
| 129 | Install-NpmPackage -Binary "vscode-json-language-server" -Package "vscode-langservers-extracted" | ||
| 130 | Install-WingetPackage -Binary "lua-language-server" -Id "LuaLS.lua-language-server" | ||
| 131 | Install-NpmPackage -Binary "prisma-language-server" -Package "@prisma/language-server" | ||
| 132 | Install-NpmPackage -Binary "vtsls" -Package "@vtsls/language-server" | ||
| 133 | } | ||
| 134 | |||
| 135 | function Main { | ||
| 136 | Test-Prerequisites | ||
| 137 | |||
| 138 | Install-Prerequisites | ||
| 139 | Install-Formatters | ||
| 140 | Install-Tools | ||
| 141 | Install-Lsp | ||
| 142 | |||
| 143 | Write-Host "" | ||
| 144 | if ($script:Failures.Count -eq 0) { | ||
| 145 | Write-Host "Bootstrap abgeschlossen." -ForegroundColor Green | ||
| 146 | } else { | ||
| 147 | Write-Host "Bootstrap abgeschlossen, mit $($script:Failures.Count) Warnung(en):" -ForegroundColor Yellow | ||
| 148 | foreach ($f in $script:Failures) { | ||
| 149 | Write-Host " - $f" -ForegroundColor Yellow | ||
| 150 | } | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | Main | ||
diff --git a/neovim-windows-setup.md b/neovim-windows-setup.md index 7c8e7f3..555c273 100644 --- a/neovim-windows-setup.md +++ b/neovim-windows-setup.md | |||
| @@ -26,54 +26,19 @@ Nach Änderungen im Repo `install-win.cmd` erneut ausführen, um die Kopien zu a | |||
| 26 | 26 | ||
| 27 | ## 3. Externe Abhängigkeiten | 27 | ## 3. Externe Abhängigkeiten |
| 28 | 28 | ||
| 29 | `bootstrap/neovim.sh` bricht unter Windows sofort ab (`Nicht unterstütztes Betriebssystem`) – die Pakete müssen manuell installiert werden: | 29 | `bootstrap/neovim.sh` bricht unter Windows sofort ab (`Nicht unterstütztes Betriebssystem`). Stattdessen `bootstrap/neovim-win.ps1` ausführen (reines PowerShell, kein Git Bash/WSL nötig): |
| 30 | 30 | ||
| 31 | **Tools** | ||
| 32 | ```powershell | 31 | ```powershell |
| 33 | winget install BurntSushi.ripgrep.MSVC | 32 | .\bootstrap\neovim-win.ps1 |
| 34 | winget install sharkdp.fd | ||
| 35 | winget install tree-sitter.tree-sitter | ||
| 36 | ``` | 33 | ``` |
| 37 | 34 | ||
| 38 | **C-Compiler** (nötig, damit `nvim-treesitter` Parser kompilieren kann): | 35 | Installiert per `winget`/`npm`: Git, Node, Formatter (jq, prettier, ruff, shfmt, stylua, yamlfmt, gawk, xmllint), Tools (ripgrep, fd, tree-sitter-cli, zig als C-Compiler für Treesitter, make) und LSP-Server (basedpyright, bash-language-server, clangd, shellcheck, vscode-langservers-extracted, lua-language-server, prisma, vtsls). Einzelne Pakete, die fehlschlagen, werden als Warnung gemeldet statt das Skript abzubrechen – Details siehe Kopfkommentar im Skript (einige winget-IDs, v. a. GnuWin32.Gawk/Libxml2, google.yamlfmt, mvdan.shfmt, astral-sh.ruff, zig.zig, sind ungeprüft). |
| 39 | ```powershell | ||
| 40 | winget install zig.zig | ||
| 41 | ``` | ||
| 42 | (zig funktioniert als `cc`-Ersatz für Treesitter; alternativ MSVC Build Tools oder MinGW-w64) | ||
| 43 | 36 | ||
| 44 | **Make** (für `opt.makeprg = "gmake"`): | 37 | `windows\bin` (enthält `gmake.cmd`, Wrapper für `opt.makeprg = "gmake"`) danach einmalig zum PATH hinzufügen: |
| 45 | ```powershell | ||
| 46 | winget install GnuWin32.Make | ||
| 47 | ``` | ||
| 48 | Anschließend `windows\bin` (enthält `gmake.cmd`, einen Wrapper der an `make` durchreicht) einmalig zum PATH hinzufügen: | ||
| 49 | ```powershell | 38 | ```powershell |
| 50 | setx PATH "%PATH%;%USERPROFILE%\dotfiles\windows\bin" | 39 | setx PATH "%PATH%;%USERPROFILE%\dotfiles\windows\bin" |
| 51 | ``` | 40 | ``` |
| 52 | 41 | ||
| 53 | **Formatter** (conform.nvim): | ||
| 54 | ```powershell | ||
| 55 | winget install jqlang.jq | ||
| 56 | npm install -g prettier | ||
| 57 | pip install ruff | ||
| 58 | winget install mvdan.shfmt | ||
| 59 | winget install JohnnyMorganz.StyLua | ||
| 60 | winget install google.yamlfmt | ||
| 61 | winget install GnuWin32.Gawk | ||
| 62 | ``` | ||
| 63 | `xmllint` (für XML/XSD) ist in libxml2 enthalten – z. B. über `winget install GnuWin32.Libxml2` oder in Git for Windows bereits vorhanden. | ||
| 64 | |||
| 65 | **LSP-Server**: | ||
| 66 | ```powershell | ||
| 67 | npm install -g basedpyright | ||
| 68 | npm install -g bash-language-server | ||
| 69 | npm install -g vscode-langservers-extracted | ||
| 70 | npm install -g @prisma/language-server | ||
| 71 | npm install -g @vtsls/language-server | ||
| 72 | winget install LLVM.LLVM # clangd | ||
| 73 | winget install koalaman.shellcheck | ||
| 74 | winget install LuaLS.lua-language-server | ||
| 75 | ``` | ||
| 76 | |||
| 77 | ## 4. Bekannte Stolpersteine | 42 | ## 4. Bekannte Stolpersteine |
| 78 | 43 | ||
| 79 | - **`g.python3_host_prog`** in `nvim/lua/config/options.lua` ist hart auf einen Unix-Pfad (`$HOME/.local/venv/nvim/bin/python`) gesetzt. Unter Windows existiert weder dieses `HOME`-Layout noch `bin/python` (dort `Scripts\python.exe`). Aktuell nutzt kein installiertes Plugin die Python-Provider-API – daher unkritisch, kann ignoriert werden, solange `:python3`-Funktionen nicht gebraucht werden. (Erwägenswert: `g.loaded_python3_provider = 0` setzen, dann verschwindet das Problem ganz – separat besprochen, noch nicht umgesetzt.) | 44 | - **`g.python3_host_prog`** in `nvim/lua/config/options.lua` ist hart auf einen Unix-Pfad (`$HOME/.local/venv/nvim/bin/python`) gesetzt. Unter Windows existiert weder dieses `HOME`-Layout noch `bin/python` (dort `Scripts\python.exe`). Aktuell nutzt kein installiertes Plugin die Python-Provider-API – daher unkritisch, kann ignoriert werden, solange `:python3`-Funktionen nicht gebraucht werden. (Erwägenswert: `g.loaded_python3_provider = 0` setzen, dann verschwindet das Problem ganz – separat besprochen, noch nicht umgesetzt.) |
