# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Overview This is a personal Neovim configuration built on lazy.nvim with a focus on LSP, testing, and modern plugin management. The configuration emphasizes a clean, modular structure with separate plugin files. ## Architecture ### Core Structure - **init.lua**: Entry point that sets up vim options, loads lazy.nvim, and initializes core modules - **lua/keybinds.lua**: Global keybindings (ALT navigation, terminal toggle, C# namespace helper) - **lua/diagnostic.lua**: Diagnostic display configuration with custom signs and virtual text - **lua/snippets.lua**: LuaSnip snippets (currently contains C# namespace/class generation) - **lua/plugins/**: Modular plugin configurations, each file returns a lazy.nvim plugin spec ### Plugin Architecture Pattern Each plugin file follows lazy.nvim's structure: ```lua return { 'author/plugin-name', dependencies = { ... }, opts = { ... }, config = function() ... end, } ``` ## Key Plugins & Configuration ### LSP (lua/plugins/lsp.lua) - Uses mason.nvim with custom registry including Crashdummyy's registry - Configured servers: lua_ls, vtsls, jsonls (with schemastore), bashls, zls, cssls, prismals, intelephense, html, yamlls, eslint, tailwindcss, gopls, rust_analyzer, roslyn - Auto-installs tools: stylua, prettierd, php-cs-fixer, cspell - Blink.cmp integration for completion capabilities - Keybindings set on LspAttach: - `a`: Code actions - `gd`, `gr`, `gi`: Definition/references/implementation via Telescope - ``: Rename - `d`: Show diagnostics float - `D`: Jump to next diagnostic ### Formatting (lua/plugins/conform.lua) - Format-on-save enabled (3s timeout) - Formatters: stylua (Lua), prettierd/prettier (JS/TS/CSS/JSON/Markdown), php-cs-fixer (PHP), gofmt (Go), csharpierd (C#) - Manual format: `f` ### Testing (lua/plugins/neotest.lua) - Adapters: neotest-jest, neotest-bun - Jest config auto-detection from project root - Keybindings: - `tt`: Run nearest test - `tf`: Run all tests in current file - `td`: Display test output ### Fuzzy Finding (lua/plugins/telescope.lua) - Keybindings (all start with `f`): - `ff`: Find files - `fg`: Live grep - `fb`: Buffers - `fd`: Diagnostics - `fw`: Grep string under cursor - `fh/fk/fs/fr/f.`: Help/keymaps/builtin/resume/oldfiles - `ft`: Todo comments ### C# Development - Roslyn LSP configured - Custom namespace insertion: `n` (reads .csproj, constructs namespace from path) - C# class snippet: `csc` (auto-generates namespace and class from filename) - csharpierd formatter integration ## Development Workflow ### Testing JavaScript/TypeScript ```bash # Run nearest test (with cursor on test) tt # Run all tests in file tf # View test output td ``` ### Formatting - Auto-formats on save (configured in conform.lua) - Manual format: `f` ### LSP Operations - Jump to definition: `gd` (opens in Telescope) - Find references: `gr` (opens in Telescope) - Rename symbol: `` - Code actions: `a` - Show diagnostics: `d` - Next diagnostic: `D` - Workspace symbols: `fs` ## Special Configurations ### Clipboard Uses xclip for clipboard integration on Linux (configured in init.lua with vim.schedule) ### Theme TokyoNight theme with transparency disabled on WSL, terminal colors disabled ### Tab Behavior 2-space indentation, tabs converted to spaces globally ### Window Navigation - ALT + Arrow keys to navigate between splits - `` mapped to `` for jump forward ### Terminal - ``: Open terminal in insert mode - ``: Exit terminal mode to normal mode ## Plugin Management ### Installing/Updating Plugins Lazy.nvim auto-bootstraps on first run. To manage plugins: - Add new plugin specs to lua/plugins/ or directly in init.lua's require('lazy').setup() - Lazy will auto-install on next startup ### Mason Tool Management LSP servers and formatters are auto-installed via mason-tool-installer based on the ensure_installed list in lua/plugins/lsp.lua ## Important Notes - Leader key is Space - Nerd Font required (vim.g.have_nerd_font = true) - Swap and backup files disabled - Relative line numbers enabled - 10-line scrolloff for cursor positioning - The configuration uses Neovim 0.10+ APIs with compatibility shim for 0.11 (see client_supports_method in lsp.lua)