Files
dotfiles/.config/nvim/README.md
Baerspektivo 8230492c3a feat: Sync complete config - Fish, Ghostty, Neovim Scratch
- Add missing Fish configs (direnv, ssh function)
- Add Tokyo Night theme for Ghostty
- Complete Neovim scratch config sync
- Rewrite install.sh for new structure
- Add comprehensive README.md
2025-10-13 10:00:52 +02:00

242 lines
5.5 KiB
Markdown

# 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
- `<leader>w` - Save file
- `<Esc>` - Clear search highlight
- `jk` / `jj` - Exit insert mode
### Navigation
- `<C-h/j/k/l>` - Navigate windows
- `<S-h/l>` - Previous/Next buffer
- `<leader>bd` - Delete buffer
### Telescope (Find)
- `<leader>ff` - Find files
- `<leader>fg` - Live grep
- `<leader>fb` - Buffers
- `<leader>fo` - Recent files
- `<leader>fw` - Find word under cursor
- `<leader>fd` - Diagnostics
- `<leader>/` - Search in buffer
### Harpoon (File Navigation)
- `<leader>a` - Add file to Harpoon
- `<leader>h` - Toggle Harpoon menu
- `<C-j/k/l/;>` - Jump to file 1/2/3/4
### Neo-tree (Explorer)
- `<leader>e` - Toggle explorer
- `<leader>ef` - Focus filesystem
- `<leader>eb` - Focus buffers
- `<leader>eg` - Focus git status
### LSP
- `gd` - Goto definition
- `gr` - Goto references
- `gI` - Goto implementation
- `K` - Hover documentation
- `<leader>ca` - Code action
- `<leader>rn` - Rename
- `[d` / `]d` - Previous/Next diagnostic
### Git
- `<leader>gs` - Git status (Fugitive)
- `<leader>gc` - Git commit
- `<leader>gp` - Git push
- `<leader>gb` - Git blame
- `<leader>hs` - Stage hunk
- `<leader>hr` - Reset hunk
- `<leader>hp` - Preview hunk
- `[c` / `]c` - Previous/Next git hunk
### Go Specific
- `<leader>ee` - Insert `if err != nil { return err }`
### Formatting
- `<leader>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', '<leader>ff', '<cmd>Telescope find_files<CR>')
```
### 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 <command>` 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