mirror of
https://github.com/itme-brain/nvim.git
synced 2026-05-08 07:00:13 -04:00
116 lines
4.3 KiB
Markdown
116 lines
4.3 KiB
Markdown
# 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** (`<leader>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 (`<leader>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/<language>/`.
|
|
`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 `<leader>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 |
|
|
|-----|--------|
|
|
| `<leader>css` | Start LSP (smart picker) |
|
|
| `<leader>csx` | Stop LSP |
|
|
| `<leader>csr` | Restart LSP |
|
|
| `<leader>cf` | Format code |
|
|
| `<leader>ca` | Code action |
|
|
| `<leader>cr` | Rename symbol |
|
|
| `gd` | Go to definition |
|
|
| `<leader>gr` | Find references |
|
|
| `<leader>e` | Toggle file explorer |
|
|
| `<leader>bd` | Delete buffer |
|
|
| `<leader>/` | Live grep from git root |
|
|
| `<leader>ff` | Find files from git root |
|
|
| `<leader>db` | Toggle breakpoint |
|
|
| `<leader>dB` | Set conditional breakpoint |
|
|
| `<leader>dc` | Continue debugging |
|
|
| `<leader>di` | Step into |
|
|
| `<leader>do` | Step over |
|
|
| `<leader>dO` | Step out |
|
|
| `<leader>du` | Toggle debug UI |
|
|
| `<leader>dt` | Terminate debug session |
|
|
| `<leader>de` | Evaluate expression |
|
|
| `<leader>ds` | Debug configurations |
|
|
| `<leader>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
|