# Neovim Configuration Portable Neovim configuration using lazy.nvim, Mason-managed tooling, native LSP, native Treesitter, Telescope, and DAP (Neovim 0.11+, tested on 0.12.1). ## Installation ### Standalone (any system) ```bash git clone git@github.com:itme-brain/nvim.git ~/.config/nvim ``` ### As part of NixOS config ```bash git clone --recurse-submodules git@github.com:itme-brain/nixos.git ``` ## Plugin Lockfile This config does not commit `lazy-lock.json`. When Home Manager deploys this config from a flake, `~/.config/nvim` can point into `/nix/store`, which is read-only. lazy.nvim normally writes its lockfile to `stdpath("config")`, so this config stores the runtime lockfile at `stdpath("state") .. "/lazy-lock.json"` instead. ## Features - **Native LSP** (`vim.lsp.config` / `vim.lsp.enable`) - no manual server list needed - **Smart LSP picker** (`css`) - auto-detects installed servers for current filetype - **Neovim 0.12 compatible** - uses built-in `:lsp` commands and keeps legacy `:Lsp*` aliases working - **Portable** - Mason is the source of truth for LSP servers and debug adapters - **Treesitter** - uses native `vim.treesitter.*` APIs with community fork provisioning - **Debugging** - lazy-loaded `nvim-dap` stack with Mason-managed adapters ## LSP Setup Mason installs the shared LSP baseline on every system: - `lua_ls` - Lua/Neovim - `nil_ls` - Nix - `bashls` - Bash/Shell - `jsonls` - JSON - `html` - HTML - `cssls` - CSS - `marksman` - Markdown - `taplo` - TOML - `yamlls` - YAML On NixOS, Mason-installed binaries require `nix-ld` so downloaded tools can execute. The NixOS module should provide `nix-ld`; Neovim itself does not keep a separate Nix-only LSP package list. The smart picker (`css`) scans all lspconfig servers and shows only those with binaries installed. On Neovim 0.12+, start/stop/restart uses the built-in `:lsp` commands under the hood. ## Treesitter Treesitter uses Neovim's native API: - Highlighting starts through `vim.treesitter.start` - Parser/filetype mappings use `vim.treesitter.language.register` - Parsers and queries are provisioned by the community `neovim-treesitter/nvim-treesitter` fork Neovim loads compiled parser libraries from `parser/` directories on `runtimepath` and query files from `queries//`. `tree-sitter-cli` is only needed by the provisioner when installing or updating parsers; it is not required at runtime for highlighting. Mason bootstraps `tree-sitter-cli` when parser installation is needed. ## Debugging Debugging uses `nvim-dap`, `nvim-dap-ui`, `nvim-dap-virtual-text`, `telescope-dap.nvim`, and `mason-nvim-dap.nvim`. The DAP stack is lazy-loaded. Normal startup does not load DAP; it loads only when a `:Dap...` command runs or a `d...` mapping is used. Mason installs: - `debugpy` - Python - `codelldb` - C/C++/Rust - `bash-debug-adapter` - Bash - `js-debug-adapter` - JavaScript/TypeScript ## Key Bindings | Key | Action | |-----|--------| | `css` | Start LSP (smart picker) | | `csx` | Stop LSP | | `csr` | Restart LSP | | `cf` | Format code | | `ca` | Code action | | `cr` | Rename symbol | | `gd` | Go to definition | | `gr` | Find references | | `e` | Toggle file explorer | | `bd` | Delete buffer | | `/` | Live grep from git root | | `ff` | Find files from git root | | `db` | Toggle breakpoint | | `dB` | Set conditional breakpoint | | `dc` | Continue debugging | | `di` | Step into | | `do` | Step over | | `dO` | Step out | | `du` | Toggle debug UI | | `dt` | Terminate debug session | | `de` | Evaluate expression | | `ds` | Debug configurations | | `dS` | Debug breakpoints | ## Plugins - **lazy.nvim** - plugin manager - **nvim-lspconfig** - LSP configurations - **nvim-cmp** - completion - **telescope.nvim** - fuzzy finder - **Native Treesitter** - syntax highlighting - **neovim-treesitter** - parser and query provisioning - **nvim-dap** - debug adapter client - **nvim-dap-ui** - debugging UI panes - **mason-nvim-dap.nvim** - Mason debug adapter integration - **neo-tree.nvim** - file explorer - **gitsigns.nvim** - git integration - **lualine.nvim** - statusline - **bufferline.nvim** - buffer tabs - **which-key.nvim** - keybinding hints