From b504e16f941470d46c0f8495f7ea4368e5d14871 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Thu, 23 Jul 2026 10:00:34 +0200 Subject: windows: install-win.cmd durch install-win.ps1 ersetzt, neovim-dict-win.ps1 ergaenzt install-win.cmd entfernt, install-win.ps1 (reines PowerShell) uebernimmt dieselbe Aufgabe (Config-Kopie nach %LOCALAPPDATA%\nvim, .gitconfig, config-up2parts, npmrc). Ausserdem bootstrap/neovim-dict-win.ps1 als PowerShell-Pendant zu bootstrap/neovim-dict.sh: laedt die deutschen Rechtschreib-Woerterbuecher nach %LOCALAPPDATA%\nvim-data\site\spell. neovim-windows-setup.md aktualisiert: verweist jetzt durchgehend auf die .ps1-Skripte statt .cmd/Git-Bash, Python-Installationsschritt entfernt (Provider ist deaktiviert), Stolperstein-Liste bereinigt. --- bootstrap/neovim-dict-win.ps1 | 64 +++++++++++++++++++++++++++++ install-win.cmd | 64 ----------------------------- install-win.ps1 | 93 +++++++++++++++++++++++++++++++++++++++++++ neovim-windows-setup.md | 20 ++++++---- 4 files changed, 170 insertions(+), 71 deletions(-) create mode 100644 bootstrap/neovim-dict-win.ps1 delete mode 100644 install-win.cmd create mode 100644 install-win.ps1 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 @@ +#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 diff --git a/install-win.cmd b/install-win.cmd deleted file mode 100644 index 007516d..0000000 --- a/install-win.cmd +++ /dev/null @@ -1,64 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -rem Windows-natives Pendant zu install.sh. -rem Kopiert (statt zu verlinken) die relevanten Konfigurationen an ihre -rem nativen Windows-Zielorte. install.sh bleibt unveraendert; dieses -rem Skript ist bewusst eigenstaendig, da FreeBSD/macOS und Windows zu -rem unterschiedlich sind fuer eine gemeinsame Installationsroutine. -rem -rem Hinweis: Nach Aenderungen an nvim/ oder git/ dieses Skript erneut -rem ausfuehren, um die Kopien zu aktualisieren (keine Symlinks). - -set "SCRIPT_DIR=%~dp0" - -set "NVIM_SRC=%SCRIPT_DIR%nvim" -set "NVIM_DST=%LOCALAPPDATA%\nvim" - -set "GIT_CONFIG_SRC=%SCRIPT_DIR%git\config" -set "GIT_CONFIG_DST=%USERPROFILE%\.gitconfig" - -set "GIT_UP2PARTS_SRC=%SCRIPT_DIR%git\config-up2parts" -set "GIT_XDG_DIR=%USERPROFILE%\.config\git" -set "GIT_UP2PARTS_DST=%GIT_XDG_DIR%\config-up2parts" - -set "NPMRC_SRC=%SCRIPT_DIR%npm\npmrc" -set "NPMRC_DST=%USERPROFILE%\.npmrc" - -echo === nvim === -robocopy "%NVIM_SRC%" "%NVIM_DST%" /MIR /NFL /NDL /NJH /NJS >nul -if %ERRORLEVEL% GEQ 8 ( - echo Fehler: nvim-Konfiguration konnte nicht nach "%NVIM_DST%" kopiert werden. - exit /b 1 -) -echo OK: %NVIM_DST% - -echo === git === -copy /Y "%GIT_CONFIG_SRC%" "%GIT_CONFIG_DST%" >nul -if errorlevel 1 ( - echo Fehler: git-Konfiguration konnte nicht nach "%GIT_CONFIG_DST%" kopiert werden. - exit /b 1 -) -echo OK: %GIT_CONFIG_DST% - -if not exist "%GIT_XDG_DIR%" mkdir "%GIT_XDG_DIR%" -copy /Y "%GIT_UP2PARTS_SRC%" "%GIT_UP2PARTS_DST%" >nul -if errorlevel 1 ( - echo Fehler: config-up2parts konnte nicht nach "%GIT_UP2PARTS_DST%" kopiert werden. - exit /b 1 -) -echo OK: %GIT_UP2PARTS_DST% ^(wird per includeIf aus .gitconfig eingebunden^) - -echo === npm === -if exist "%NPMRC_DST%" ( - echo Uebersprungen: %NPMRC_DST% existiert bereits. -) else ( - copy /Y "%NPMRC_SRC%" "%NPMRC_DST%" >nul - echo OK: %NPMRC_DST% -) - -echo. -echo Fertig. Dateien wurden KOPIERT, nicht verlinkt. -echo Nach Aenderungen im Repo dieses Skript erneut ausfuehren. - -endlocal diff --git a/install-win.ps1 b/install-win.ps1 new file mode 100644 index 0000000..41b3b51 --- /dev/null +++ b/install-win.ps1 @@ -0,0 +1,93 @@ +#Requires -Version 5.1 +<# + Windows-natives Pendant zu install.sh (ersetzt install-win.cmd). + install.sh bleibt unveraendert - kopiert (statt zu verlinken) die + relevanten Konfigurationen an ihre nativen Windows-Zielorte. Keine + Admin-Rechte noetig (keine Symlinks). + + Aufruf: + .\install-win.ps1 + + Falls die Ausfuehrung durch die Execution Policy blockiert wird: + powershell -ExecutionPolicy Bypass -File .\install-win.ps1 + + Hinweis: Es wird KOPIERT, nicht verlinkt. Nach Aenderungen im Repo + dieses Skript erneut ausfuehren, um die Kopien zu aktualisieren. +#> + +$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" -ForegroundColor DarkGray +} + +$RepoRoot = $PSScriptRoot + +$NvimSrc = Join-Path $RepoRoot "nvim" +$NvimDst = Join-Path $env:LOCALAPPDATA "nvim" + +$GitConfigSrc = Join-Path $RepoRoot "git\config" +$GitConfigDst = Join-Path $env:USERPROFILE ".gitconfig" + +$GitUp2partsSrc = Join-Path $RepoRoot "git\config-up2parts" +$GitXdgDir = Join-Path $env:USERPROFILE ".config\git" +$GitUp2partsDst = Join-Path $GitXdgDir "config-up2parts" + +$NpmrcSrc = Join-Path $RepoRoot "npm\npmrc" +$NpmrcDst = Join-Path $env:USERPROFILE ".npmrc" + +function Copy-NvimConfig { + Write-Step "nvim -> $NvimDst" + + if (Test-Path $NvimDst) { + Remove-Item -Recurse -Force $NvimDst + } + + Copy-Item -Recurse -Force $NvimSrc $NvimDst + Write-Ok $NvimDst +} + +function Copy-GitConfig { + Write-Step "git\config -> $GitConfigDst" + Copy-Item -Force $GitConfigSrc $GitConfigDst + Write-Ok $GitConfigDst + + if (-not (Test-Path $GitXdgDir)) { + New-Item -ItemType Directory -Path $GitXdgDir -Force | Out-Null + } + + Write-Step "git\config-up2parts -> $GitUp2partsDst" + Copy-Item -Force $GitUp2partsSrc $GitUp2partsDst + Write-Ok "$GitUp2partsDst (wird per includeIf aus .gitconfig eingebunden)" +} + +function Copy-Npmrc { + if (Test-Path $NpmrcDst) { + Write-SkipMsg "$NpmrcDst existiert bereits, uebersprungen" + return + } + + Write-Step "npm\npmrc -> $NpmrcDst" + Copy-Item -Force $NpmrcSrc $NpmrcDst + Write-Ok $NpmrcDst +} + +function Main { + Copy-NvimConfig + Copy-GitConfig + Copy-Npmrc + + Write-Host "" + Write-Host "Fertig. Dateien wurden KOPIERT, nicht verlinkt." -ForegroundColor Green + Write-Host "Nach Aenderungen im Repo dieses Skript erneut ausfuehren." +} + +Main diff --git a/neovim-windows-setup.md b/neovim-windows-setup.md index 555c273..bc27f4a 100644 --- a/neovim-windows-setup.md +++ b/neovim-windows-setup.md @@ -2,27 +2,34 @@ Checkliste für die Übernahme der bestehenden `nvim/`-Config aus dem Dotfiles-Repo auf ein natives Windows-System (kein WSL). Repo selbst bleibt unverändert. +Alle Windows-Skripte in diesem Repo sind reines PowerShell (kein Git Bash, kein WSL). Falls die Ausführung durch die Execution Policy blockiert wird, entweder pro Aufruf `powershell -ExecutionPolicy Bypass -File .\skript.ps1` verwenden, oder einmalig `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`. + ## 1. Grundwerkzeuge installieren ```powershell winget install Neovim.Neovim winget install Git.Git winget install OpenJS.NodeJS.LTS -winget install Python.Python.3.12 ``` -Git for Windows bringt Git Bash mit – eine POSIX-Shell, mit der `install.sh` und die `bootstrap/*.sh`-Skripte direkt lauffähig sind (kein Portieren nach PowerShell nötig). +(Kein Python nötig – der Python-Provider ist in `options.lua` deaktiviert, siehe Abschnitt 4.) ## 2. Konfiguration einrichten (Windows-nativer Weg) -Statt `install.sh` samt XDG-Umgebungsvariablen zu verbiegen: `install-win.cmd` im Repo-Root ausführen. Es kopiert (keine Symlinks, keine Admin-Rechte nötig): +`install-win.ps1` im Repo-Root ausführen: + +```powershell +.\install-win.ps1 +``` + +Es kopiert (keine Symlinks, keine Admin-Rechte nötig): - `nvim/` → `%LOCALAPPDATA%\nvim` - `git/config` → `%USERPROFILE%\.gitconfig` - `git/config-up2parts` → `%USERPROFILE%\.config\git\config-up2parts` (Pfad ist im `includeIf` von `git/config` hartkodiert) - `npm/npmrc` → `%USERPROFILE%\.npmrc` (nur falls dort noch keine Datei existiert) -Nach Änderungen im Repo `install-win.cmd` erneut ausführen, um die Kopien zu aktualisieren. +Nach Änderungen im Repo `install-win.ps1` erneut ausführen, um die Kopien zu aktualisieren. ## 3. Externe Abhängigkeiten @@ -41,9 +48,8 @@ setx PATH "%PATH%;%USERPROFILE%\dotfiles\windows\bin" ## 4. Bekannte Stolpersteine -- **`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.) -- **`scripts/sonarqube.sh`** (`:SonarIssues`): reines POSIX-Shellskript. Läuft nur, wenn ein `sh` im PATH liegt (z. B. `sh.exe` aus Git for Windows im PATH verfügbar machen). -- **`bootstrap/neovim-dict.sh`** (deutsche Rechtschreibprüfung): unter Git Bash direkt ausführbar. Lädt die Dateien nach `~/.local/share/nvim/site/spell`; unter nativem Windows-Neovim stattdessen manuell nach `%LOCALAPPDATA%\nvim-data\site\spell` legen. +- **Rechtschreibprüfung (Deutsch)**: `bootstrap/neovim-dict-win.ps1` ausführen – lädt `de.utf-8.spl`/`.sug` nach `%LOCALAPPDATA%\nvim-data\site\spell` (nativer Windows-Datenpfad von Neovim). +- **`scripts/sonarqube.sh`** (`:SonarIssues`): reines POSIX-Shellskript, kein Windows-Pendant vorhanden. Läuft nur, wenn ein `sh` im PATH liegt (z. B. `sh.exe` aus Git for Windows im PATH verfügbar machen); ansonsten `:SonarIssues` auf Windows nicht nutzen. - **Clipboard** (`unnamedplus`): funktioniert nativ unter Windows-Neovim ohne Zusatztool – anders als unter WSL, wo `win32yank` nötig wäre. - **`opt.guifont`**: wirkt nur bei GUI-Frontends wie Neovide. Im Windows Terminal muss die Schriftart dort separat eingestellt werden. -- cgit v1.3