# Neovim Configuration - Built from Scratch Moderne, minimale Neovim Config optimiert für **TypeScript/Playwright QA** und **Go Development**. ## 🎯 Philosophie - **Scratch mit lazy.nvim**: Keine Distro, keine Abstraktionen - **TypeScript First**: Optimiert für Playwright Tests - **Go Ready**: Volle gopls Integration - **Verständlich**: Jede Datei hat einen klaren Zweck - **Wartbar**: Standard Neovim APIs, keine Magie ## 📁 Struktur ``` ~/.config/nvim/ ├── init.lua # Entry point ├── lua/ │ ├── core/ │ │ ├── options.lua # Vim Settings │ │ ├── keymaps.lua # Keybindings │ │ └── lazy.lua # lazy.nvim Bootstrap │ └── plugins/ │ ├── lsp.lua # LSP (ts_ls, gopls, etc.) │ ├── completion.lua # nvim-cmp │ ├── treesitter.lua # Syntax Highlighting │ ├── telescope.lua # Fuzzy Finder │ ├── harpoon.lua # File Navigation │ ├── neotree.lua # File Explorer │ ├── git.lua # Git Integration │ ├── formatting.lua # Code Formatting │ ├── ui.lua # Theme + Statusline │ └── editor.lua # QoL Plugins ``` ## 🚀 Installation ### Prerequisites ```bash # Neovim 0.10+ brew install neovim # Ripgrep (für Telescope) brew install ripgrep # Node.js (für TypeScript LSP) brew install node # Go (für gopls) brew install go ``` ### Setup ```bash # Backup alte Config (falls vorhanden) mv ~/.config/nvim ~/.config/nvim.backup # Symlink aus dotfiles ln -sf ~/gits/dotfiles/.config/nvim ~/.config/nvim # Neovim starten - lazy.nvim installiert automatisch nvim ``` Beim ersten Start: 1. lazy.nvim installiert sich selbst 2. Alle Plugins werden geladen 3. Mason installiert LSP Server automatisch 4. Treesitter installiert Parser **Warte bis alles fertig ist!** (~2-3 Minuten) ## ⌨️ Key Bindings ### Leader Key: `Space` ### Core - `w` - Save file - `` - Clear search highlight - `jk` / `jj` - Exit insert mode ### Navigation - `` - Navigate windows - `` - Previous/Next buffer - `bd` - Delete buffer ### Telescope (Find) - `ff` - Find files - `fg` - Live grep - `fb` - Buffers - `fo` - Recent files - `fw` - Find word under cursor - `fd` - Diagnostics - `/` - Search in buffer ### Harpoon (File Navigation) - `a` - Add file to Harpoon - `h` - Toggle Harpoon menu - `` - Jump to file 1/2/3/4 ### Neo-tree (Explorer) - `e` - Toggle explorer - `ef` - Focus filesystem - `eb` - Focus buffers - `eg` - Focus git status ### LSP - `gd` - Goto definition - `gr` - Goto references - `gI` - Goto implementation - `K` - Hover documentation - `ca` - Code action - `rn` - Rename - `[d` / `]d` - Previous/Next diagnostic ### Git - `gs` - Git status (Fugitive) - `gc` - Git commit - `gp` - Git push - `gb` - Git blame - `hs` - Stage hunk - `hr` - Reset hunk - `hp` - Preview hunk - `[c` / `]c` - Previous/Next git hunk ### Go Specific - `ee` - Insert `if err != nil { return err }` ### Formatting - `cf` - Format buffer - `:FormatDisable` - Disable auto-format - `:FormatEnable` - Enable auto-format ## 🛠️ LSP Servers Automatisch installiert via Mason: - **ts_ls** - TypeScript/JavaScript (Playwright) - **gopls** - Go - **lua_ls** - Lua - **html** - HTML - **cssls** - CSS - **jsonls** - JSON (mit Schema support) - **yamlls** - YAML (mit Schema support) - **dockerls** - Dockerfile - **docker_compose_language_service** - Docker Compose ### Weitere Sprachen hinzufügen 1. Öffne `lua/plugins/lsp.lua` 2. Füge Server zu `ensure_installed` hinzu 3. Füge Server Config hinzu (siehe Beispiele im File) 4. `:Mason` - Check ob installiert ## 🔧 Customization ### Options ändern Editiere `lua/core/options.lua`: ```lua opt.relativenumber = true -- Enable relative numbers ``` ### Keybindings ändern Editiere `lua/core/keymaps.lua`: ```lua keymap('n', 'ff', 'Telescope find_files') ``` ### Plugin hinzufügen Neue Datei in `lua/plugins/`: ```lua -- lua/plugins/myplugin.lua return { { 'author/plugin-name', config = function() -- Setup here end, }, } ``` ### Plugin entfernen Datei löschen oder Plugin auskommentieren, dann: ```vim :Lazy clean ``` ## 🐛 Troubleshooting ### LSP funktioniert nicht ```vim :LspInfo " Check LSP status :Mason " Check installed servers :checkhealth " General health check ``` ### Plugin-Probleme ```vim :Lazy " Plugin manager UI :Lazy sync " Update all plugins :Lazy clean " Remove unused plugins ``` ### Performance ```vim :Lazy profile " Check startup time ``` ## 📦 Updates ```bash # In Neovim: :Lazy sync # Update plugins # Mason LSP updates: :Mason # Then 'U' für update all ``` ## 🎓 Lernen Wenn du was nicht verstehst: 1. Schau in die entsprechende Datei (gut kommentiert!) 2. `:help ` nutzen 3. Frag Claude 😊 ## 🚨 Wichtig - **Backup**: Alte Config ist in `~/.config/nvim.kickstart-backup` - **Dotfiles**: Diese Config sollte in Git sein! - **Updates**: Regelmäßig `:Lazy sync` und `:Mason` checken ## 📝 Änderungslog - **2024-10**: Initial Scratch Build - TypeScript/Playwright optimiert - Go Support - Moderne LSP APIs (vim.lsp.config) - Harpoon v2 - Clean, modular structure