Compare commits

..

16 Commits

22 changed files with 1820 additions and 1003 deletions

20
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: lazy-lock.json
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v2.4.1
hooks:
- id: stylua

586
.secrets.baseline Normal file
View File

@@ -0,0 +1,586 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {
".gitlab-ci.yml": [
{
"type": "Secret Keyword",
"filename": ".gitlab-ci.yml",
"hashed_secret": "5ffe533b830f08a0326348a9160afafc8ada44db",
"is_verified": false,
"line_number": 17
}
],
"README.md": [
{
"type": "Basic Auth Credentials",
"filename": "README.md",
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
"is_verified": false,
"line_number": 85
}
],
"lazy-lock.json": [
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "3af1f0716a64d25be23ef3cf43648e5e476b6c35",
"is_verified": false,
"line_number": 2
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "a6cd36a945ae41022cf8fd0efc0f523490fbc8c4",
"is_verified": false,
"line_number": 3
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "3954c288d09f52eb9b230c1eff653d9442c5b1c3",
"is_verified": false,
"line_number": 4
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "834a80d9a9a8b2bc96a3d8bf2fe57670fb9b6fd9",
"is_verified": false,
"line_number": 5
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "6f4495f1dc02bda238cec4f27014054c0c2e641c",
"is_verified": false,
"line_number": 6
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "af9200fda20d54f77643da81a8bc6dee8f8bdafb",
"is_verified": false,
"line_number": 7
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "a05794a478a7b2c50f9411b5aa3e61ca7995c00e",
"is_verified": false,
"line_number": 8
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b34e425d01ca323c0c9518dc1872d9c000950ded",
"is_verified": false,
"line_number": 9
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "f603c5b7b85d947c6b27028859833b28c7c4f6b9",
"is_verified": false,
"line_number": 10
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "98d8da1a19f260ac98e1ac7520131c4d004a94c1",
"is_verified": false,
"line_number": 11
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "5b84c6ace33b445bf8154ec11bc0572b4e7cb9c5",
"is_verified": false,
"line_number": 12
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "05e1c6cb1f70c2b1760a0fd48fbbac03093f7388",
"is_verified": false,
"line_number": 13
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "9c1302a2faec1ab7af60d67653ea5c2fed8815ef",
"is_verified": false,
"line_number": 14
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "96cc789a527f8268d2cca9569b4226d76810b6e9",
"is_verified": false,
"line_number": 15
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "ede99b25244352245ad067502329795469d2736b",
"is_verified": false,
"line_number": 16
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b4035e21e845f317416c0b2ff364166eea340df9",
"is_verified": false,
"line_number": 17
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "5bb4648c4b8d90a196beb1cfe0913426e8c0570b",
"is_verified": false,
"line_number": 18
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "4052a854964a9f785a09988a47f6b05953b48120",
"is_verified": false,
"line_number": 19
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "1b392c86b55466213daa298f3a0757064b1bd4d7",
"is_verified": false,
"line_number": 20
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "13a42f8a6aaad30c842a3cb25d50a3c00dc1b251",
"is_verified": false,
"line_number": 21
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "7c333072524443dbfebd9108e64e91bb3494bf9b",
"is_verified": false,
"line_number": 22
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "ee156b6bb148f64db9dba27d63bc9f53e64c492d",
"is_verified": false,
"line_number": 23
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "06eb4a69635c6b8729c82c60674fac6c2f1b0c33",
"is_verified": false,
"line_number": 24
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "6173dccc123e0da423cce524abeb12e6f1faa6b8",
"is_verified": false,
"line_number": 25
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "667b60cbb863e5407c913e072a1d42395496e529",
"is_verified": false,
"line_number": 26
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "d849531474d4ae1c55f7a09161d82f22b2fac508",
"is_verified": false,
"line_number": 27
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "5a1a30d97742ada0ecf3565220ed861969a5a7d0",
"is_verified": false,
"line_number": 28
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "96826113d3e2f26d3bf477f968be022fb4d2f17b",
"is_verified": false,
"line_number": 29
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b04db8de0d2dbeee436a6d2addd57ca5e468853a",
"is_verified": false,
"line_number": 30
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "5bb079e4bc2f5177c0db0564407350b1f5186100",
"is_verified": false,
"line_number": 31
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "99da4574e023c99b0ab94317a83a788aaafd3fc0",
"is_verified": false,
"line_number": 32
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "4d9e8162c92d31d9e85d348bb727da8694bbd19a",
"is_verified": false,
"line_number": 33
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "4d214cee281b241ca2f213f9e8aeae69c3f62a7c",
"is_verified": false,
"line_number": 34
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b236422addddccca25bfadbeb1a86e3bc97dd50a",
"is_verified": false,
"line_number": 35
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "50fe46c2dd7cc2da2d829db7eddb28247bffb684",
"is_verified": false,
"line_number": 36
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "4151960bc1ea09bca7f709e03c782845ac4bc064",
"is_verified": false,
"line_number": 37
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "dd90ab427819a4a57c6a36511597828cfe984246",
"is_verified": false,
"line_number": 38
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "0f305546e18dacf3cdc13e231aa122d35d72578b",
"is_verified": false,
"line_number": 39
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "50878928df5e3a18e753bf59c72c340381763506",
"is_verified": false,
"line_number": 40
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "afc7b8f889a5bd08a5cdc4bf7463187b719df8d3",
"is_verified": false,
"line_number": 41
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "683f0518650b41601ae367abfcee9c4883c9f6a3",
"is_verified": false,
"line_number": 42
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "f5a85768c2fb9cd32cbd893b504f70231ead0302",
"is_verified": false,
"line_number": 43
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "f85462d0f27b3df90a78bb9a650b71c2d33df05f",
"is_verified": false,
"line_number": 44
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "1e83d6c436ae4d06000ac0f408db9d8d29c3fe0e",
"is_verified": false,
"line_number": 45
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "243f6b48ff3330e756004abe753e4c9c34028e6c",
"is_verified": false,
"line_number": 46
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "7db5b5b1c2c11679857d56addd3bd2479aab2721",
"is_verified": false,
"line_number": 47
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "cf08b67aeabdd2fd7cafcfd753da8bbab5c684d7",
"is_verified": false,
"line_number": 48
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "75ce9fc38e1e842804880912e61a1b1aea68111c",
"is_verified": false,
"line_number": 49
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "8038994bf26fbd417a89077f6ef31d1ebf6544f9",
"is_verified": false,
"line_number": 50
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b0ea3c8a9f3e55a936c4343eb8ebc7f08d3cceb9",
"is_verified": false,
"line_number": 51
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "a53747c40232cec5f46cad5d6c4a150a213714d9",
"is_verified": false,
"line_number": 52
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "d32e48780bb2ffd37e10b688cf92d9b5fc74d8a2",
"is_verified": false,
"line_number": 53
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "d16bf1d12a05db793b05d478084663fd5bb575b1",
"is_verified": false,
"line_number": 54
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "75842ef8e50bb624e56c5ca14baa3e1d4aea0671",
"is_verified": false,
"line_number": 55
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "7a4ad32c40710bf70f02a7b93b9f77b648c92c2d",
"is_verified": false,
"line_number": 56
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "b090bdd1d5916498909d802dcbd7097ca9b5a6d5",
"is_verified": false,
"line_number": 57
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "981d9335450b84272d3e271c355e6dfc1307fb13",
"is_verified": false,
"line_number": 58
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "e12dbca56cd5a0ad00da1fd4e03f1f798aecc6a3",
"is_verified": false,
"line_number": 59
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "4c141f751740b73e3132164878ad16f6e72c7e04",
"is_verified": false,
"line_number": 60
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "210f3750437c4ea33f429027c708a7683fff4ecf",
"is_verified": false,
"line_number": 61
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "33b337f5f3435a7e53244176e22c4fd5e08cf826",
"is_verified": false,
"line_number": 62
},
{
"type": "Hex High Entropy String",
"filename": "lazy-lock.json",
"hashed_secret": "f74e293d7f3cbea3435732dcc1704c5c03d8105e",
"is_verified": false,
"line_number": 63
}
]
},
"generated_at": "2026-06-06T21:52:58Z"
}

376
README.md
View File

@@ -1,18 +1,28 @@
# Neovim Configuration with LazyVim
# Neovim Configuration (LazyVim)
A comprehensive Neovim setup with LSP support, AI chat, database integration, and debugging.
A LazyVim-based setup focused on Go and Zig development, with LSP, debugging,
test running, task running, AI chat, database tooling, and a which-key cheat
sheet. Everything is lazy-loaded so plugins only activate for the filetype or
command that needs them.
## Prerequisites
- Neovim >= 0.9.0 (installed via Homebrew)
- Git
- A Nerd Font (for icons)
- Node.js (for some LSP servers and formatters)
- Go (for gopls and delve)
- **Neovim >= 0.11** (developed on 0.12.x; 0.11+ is required for the modern
`vim.lsp` / `root_markers` API used by some servers)
- **Git**
- **A Nerd Font** (icons in the explorer, statusline, dadbod UI, etc.)
- **Node.js** — TypeScript/JSON/YAML/web LSPs and `prettier`
- **Go** — `gopls`, `delve`, `gofumpt`, `goimports`
- **Zig** — the `zig` toolchain on `$PATH` (for LSP, build/run, tests, debug)
- **Python** _(optional)_`pyright` + `ruff` are configured if you use it
Most language servers, linters, formatters, and DAP adapters install
automatically through Mason on first launch.
## Installation
1. **Backup existing configuration** (if any):
1. **Back up any existing config:**
```bash
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
@@ -20,161 +30,287 @@ A comprehensive Neovim setup with LSP support, AI chat, database integration, an
mv ~/.cache/nvim ~/.cache/nvim.bak
```
2. **Clone this configuration**:
2. **Clone:**
```bash
git clone <your-repo-url> ~/.config/nvim
git clone https://git.samoneal.io/sam_oneal/nvim-config.git ~/.config/nvim
```
3. **Start Neovim**:
```bash
nvim
```
Lazy.nvim will automatically install all plugins on first launch.
3. **Launch Neovim.** lazy.nvim bootstraps itself and installs all plugins.
4. **Install LSP servers and tools**:
After plugins load, run:
```
:Mason
```
All required tools should install automatically.
4. **Install tooling** with `:Mason` (or `:MasonInstall <tool>`). Check health
with `:checkhealth` and LSP attachment with `:checkhealth lsp`.
## Features
## What's included
### Language Support (LSP + Treesitter)
- Go, Lua, TypeScript, JavaScript, HTML, CSS, JSON, YAML, Markdown, SQL, Makefile
**Base:** [LazyVim](https://www.lazyvim.org/) with leader = `<Space>`,
localleader = `\`, colorscheme `catppuccin-mocha`.
### AI Chat Integration
Supports multiple providers via [avante.nvim](https://github.com/yetone/avante.nvim):
- Anthropic Claude
- OpenAI GPT
- Google Gemini
- And more
**LazyVim extras enabled** (in `lua/config/lazy.lua`): `lang.go`, `lang.json`,
`lang.yaml`, `lang.markdown`, `lang.typescript`, `lang.tailwind`,
`dap.core`.
Set your API keys as environment variables:
```bash
export ANTHROPIC_API_KEY="your-key"
export OPENAI_API_KEY="your-key"
export GEMINI_API_KEY="your-key"
```
**Languages (LSP + Treesitter):** Go, Zig, Lua, TypeScript/JavaScript, HTML,
CSS, JSON, YAML, Markdown, SQL, Dockerfile, Python.
Switch providers: `:AvanteProvider claude|openai|gemini`
| Concern | Plugin / tool |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| LSP | nvim-lspconfig + Mason (`gopls`, `zls`, `lua_ls`, `ts_ls`, `html`, `cssls`, `jsonls`, `yamlls`, `marksman`, `sqlls`, `dockerls`, `pyright`/`ruff`) |
| Completion | blink.cmp (LazyVim default; SQL routed to dadbod) |
| Formatting | conform.nvim via LazyVim's format pipeline |
| Debugging | nvim-dap + delve (Go), codelldb (Zig/C/C++) |
| Testing | neotest (Go, Python, Zig) with in-buffer pass/fail signs |
| Coverage | nvim-coverage (Go) |
| Task running | overseer.nvim (+ user templates) |
| AI chat | [opencode.nvim](https://github.com/nickjvandyke/opencode.nvim) (provider-agnostic) |
| Database | vim-dadbod + dadbod-ui + dadbod-completion |
| Git | Neogit + diffview, plus LazyVim's lazygit |
| Explorer/picker | snacks.nvim |
| Symbols | aerial.nvim |
| Diagnostics | trouble.nvim |
| Cheat sheet | which-key.nvim (hold `<leader>`) |
### Database Integration (vim-dadbod)
- `:DBUIToggle` - Open database UI
- `:DBUIAddConnection` - Add a new connection
### AI (opencode.nvim)
AI is intentionally **environment-agnostic**: opencode.nvim drives the external
[`opencode`](https://opencode.ai) CLI, so the model/provider (Anthropic,
OpenAI, local models, etc.) is chosen in opencode's own config rather than here.
Install the `opencode` CLI separately and configure your provider there.
### Database (vim-dadbod)
Open the UI with `<leader>Du`. Add a connection with `<leader>Da`. Examples:
Connection string examples:
```
postgresql://user:pass@localhost:5432/dbname
mysql://user:pass@localhost:3306/dbname
sqlite:path/to/db.sqlite
```
### Go Debugging (DAP + Delve)
Full debugging support with breakpoints, stepping, variable inspection.
SQL completion is provided via dadbod inside SQL buffers, and SQL
autoformat-on-save is intentionally disabled (format manually with
`<leader>cf`).
## Key Bindings
## Key bindings
### Terminal
Hold `<leader>` (Space) to pop up the **which-key** menu — it lists every group
below as a live cheat sheet. Mouse is enabled (`mouse=a`), and the explorer,
dadbod UI, Neogit, DAP UI, trouble, aerial, and Overseer pickers are all
clickable.
> Note the deliberate capitalization: **`<leader>T*`** is Terminal (lowercase
> `<leader>t*` is the Test group), and **`<leader>D*`** is Database (lowercase
> `<leader>d*` is Debug).
### AI (`<leader>a`)
| Key | Action |
| --------------------- | ---------------------------------- |
| `<leader>aa` | Ask AI about current context (n/v) |
| `<leader>ax` | Ask AI about selection |
| `<leader>at` | Toggle AI panel |
| `go` | Operator: add range to AI chat |
| `goo` | Add current line to AI chat |
| `<S-C-u>` / `<S-C-d>` | Scroll AI chat up/down |
### Code Go (`<leader>cg`)
| Key | Action |
| -------------- | ------------------------------------- |
| `<leader>cgb` | Run benchmarks (`-bench=. -benchmem`) |
| `<leader>cgpc` | CPU profile |
| `<leader>cgpm` | Memory profile |
| `<leader>cgpt` | Trace profile |
### Code Zig (`<leader>cz`)
| Key | Action |
| ------------- | ---------------- |
| `<leader>czb` | `zig build` |
| `<leader>czr` | `zig build run` |
| `<leader>czt` | `zig build test` |
### Tests (neotest, `<leader>t`)
Works in Go, Python, and Zig buffers; results show as signs in the gutter.
| Key | Action |
|-----|--------|
| `<leader>th` | Open terminal (horizontal split) |
| `<leader>tv` | Open terminal (vertical split) |
| `<C-\>` | Toggle floating terminal |
| `<Esc><Esc>` | Exit terminal mode |
| `<leader>tt` | Run nearest test |
| `<leader>tf` | Run test file |
| `<leader>ts` | Toggle test summary |
| `<leader>to` | Open test output |
| `<leader>tc` | Show coverage (Go) |
### File Explorer (Snacks explorer)
| Key | Action |
|-----|--------|
| `<C-S-e>` | Toggle explorer |
| `<C-S-v>` or `<C-v>` | Open file in vertical split |
| `<C-S-h>` or `<C-x>` | Open file in horizontal split |
| `<leader>e` | Focus explorer (LazyVim default) |
### Debugging (DAP, `<leader>d`)
### AI Chat
| Key | Action |
|-----|--------|
| `<leader>aa` | Ask AI (with selection in visual mode) |
| `<leader>ac` | Open AI chat |
| `<leader>at` | Toggle AI sidebar |
### Database
| Key | Action |
|-----|--------|
| `<leader>db` | Toggle database UI |
| `<leader>da` | Add database connection |
### Debugging
Go uses delve; Zig/C/C++ use codelldb. Zig launch configs build with debug
symbols first, then run (`Launch (zig build)` prompts for the exe under
`zig-out/bin`; `Launch (current file)` compiles the open file).
| Key | Action |
|-----|--------|
| `<leader>db` | Toggle breakpoint |
| `<leader>dB` | Breakpoint with condition |
| `<leader>dc` | Continue |
| `<leader>dB` | Conditional breakpoint |
| `<leader>dc` | Continue / start |
| `<leader>dC` | Run to cursor |
| `<leader>di` | Step into |
| `<leader>do` | Step out |
| `<leader>dO` | Step over |
| `<leader>do` | Step out |
| `<leader>dj` / `<leader>dk` | Stack down / up |
| `<leader>dr` | Toggle REPL |
| `<leader>ds` | Session |
| `<leader>dt` | Terminate |
| `<leader>dw` | Inspect widget (hover) |
| `<leader>du` | Toggle DAP UI |
| `<leader>de` | Eval (n/v) |
| `<leader>dT` | Debug Go test |
| `<leader>dt` | Terminate debug session |
| `<leader>dL` | Debug last Go test |
### Formatting
| Key | Action |
|-----|--------|
| `<leader>cf` | Format buffer |
| `:FormatToggle` | Toggle auto-format on save |
| `:FormatDisable` | Disable auto-format |
| `:FormatEnable` | Enable auto-format |
### Tasks (Overseer, `<leader>o`)
### General
| Key | Action |
|-----|--------|
| `<C-s>` | Save file |
| `<S-h>` / `<S-l>` | Previous/Next buffer |
| `<C-h/j/k/l>` | Navigate windows |
| `<A-j>` / `<A-k>` | Move line down/up |
| Key | Action |
| ------------ | --------------------------------------------------------- |
| `<leader>or` | Run a task (picker — includes `go:` and `zig:` templates) |
| `<leader>ot` | Toggle task list |
## File Structure
### Database (`<leader>D`)
| Key | Action |
| ------------ | -------------- |
| `<leader>Du` | Toggle DB UI |
| `<leader>Da` | Add connection |
| `<leader>Df` | Find DB buffer |
### Git (`<leader>g`)
| Key | Action |
| ------------ | ------------------------- |
| `<leader>gg` | Lazygit (LazyVim default) |
| `<leader>gn` | Neogit |
| `<leader>gl` | Lazygit log |
| `<leader>gf` | Lazygit file history |
### Search / Symbols (`<leader>s`)
| Key | Action |
| ------------ | ------------------------ |
| `<leader>so` | Symbols outline (aerial) |
| `<leader>sh` | Incoming calls |
| `<leader>sc` | Outgoing calls |
### Diagnostics (Trouble, `<leader>x`)
| Key | Action |
| ------------ | --------------------- |
| `<leader>xx` | Diagnostics |
| `<leader>xw` | Workspace diagnostics |
| `<leader>xt` | TODOs |
### Terminal (`<leader>T`)
| Key | Action |
| ------------ | --------------------------- |
| `<leader>Th` | Terminal (horizontal split) |
| `<leader>Tv` | Terminal (vertical split) |
| `<Esc><Esc>` | Exit terminal mode |
### Explorer & windows
| Key | Action |
| ------------------------ | ----------------------------- |
| `<C-e>` | Toggle explorer (snacks) |
| `<C-S-v>` / `<C-v>` | Open file in vertical split |
| `<C-S-h>` / `<C-x>` | Open file in horizontal split |
| `<C-h/j/k/l>` | Navigate windows |
| `<C-Up/Down/Left/Right>` | Resize window |
### Formatting (LazyVim pipeline)
| Key / Command | Action |
| ------------- | -------------------------- |
| `<leader>cf` | Format buffer |
| `<leader>uf` | Toggle autoformat (buffer) |
| `<leader>uF` | Toggle autoformat (global) |
| `:LazyFormat` | Format now |
### General editing
| Key | Action |
| ------------------ | --------------------------- |
| `<C-s>` | Save file |
| `<S-h>` / `<S-l>` | Prev / next buffer |
| `<Esc>` | Clear search highlight |
| `<A-j>` / `<A-k>` | Move line/selection down/up |
| `<` / `>` (visual) | Indent, keep selection |
## Formatters by file type
| File type | Formatter |
| --------------- | ---------------------------------------- |
| Go | gofumpt, goimports (`-local github.com`) |
| Lua | stylua (2-space) |
| JS/TS/JSX/TSX | prettier (2-space, single quotes) |
| HTML/CSS/SCSS | prettier |
| JSON/JSONC/YAML | prettier |
| Markdown | prettier |
| SQL | sql-formatter (postgresql; manual only) |
## File structure
```
~/.config/nvim/
├── init.lua # Entry point
├── init.lua # Entry point → require("config.lazy")
├── lua/
│ ├── config/
│ │ ├── lazy.lua # Lazy.nvim bootstrap & LazyVim setup
│ │ ├── options.lua # General Neovim options
│ │ ├── keymaps.lua # Custom key bindings
│ │ └── autocmds.lua # Auto commands
── plugins/
├── lsp.lua # LSP & Treesitter configuration
├── ai.lua # AI chat integration (avante.nvim)
├── dadbod.lua # Database integration
├── dap.lua # Debugging configuration
├── formatting.lua # Auto-formatting (conform.nvim)
── editor.lua # Editor enhancements (snacks explorer, etc.)
│ │ ├── lazy.lua # lazy.nvim bootstrap, LazyVim + extras
│ │ ├── options.lua # Neovim options
│ │ ├── keymaps.lua # Custom keymaps
│ │ └── autocmds.lua # Autocommands (yank hl, ft tweaks, SQL no-autoformat…)
── plugins/
├── mason.lua # Tooling installs (LSP/linters/formatters/DAP)
├── lspconfig.lua # Per-server LSP config (gopls, zls, …)
├── treesitter.lua # Parsers
├── formatting.lua # conform.nvim
├── dap.lua # Debugging (Go via delve, Zig via codelldb)
── neotest.lua # Test runner (go/python/zig)
│ │ ├── go-coverage.lua # Go coverage signs
│ │ ├── overseer.lua # Task runner
│ │ ├── ai.lua # opencode.nvim
│ │ ├── dadbod.lua # Database
│ │ ├── git.lua # Neogit + diffview
│ │ ├── editor.lua # snacks tweaks + which-key groups
│ │ ├── symbols.lua # aerial
│ │ ├── dashboard.lua # trouble opts
│ │ ├── devcontainer.lua # nvim-remote-containers
│ │ ├── performance.lua # treesitter large-file guard
│ │ ├── theme.lua # catppuccin
│ │ └── zig.lua # Zig ft plugin (toolchain wired across files)
│ └── overseer/template/user/ # go_*, zig_{build,run,test} task templates
```
## Formatters by File Type
## Zig notes
| File Type | Formatter |
|-----------|-----------|
| Go | gofumpt, goimports |
| Lua | stylua |
| JS/TS/JSX/TSX | prettier |
| HTML/CSS | prettier |
| JSON/YAML | prettier |
| Markdown | prettier |
| SQL | sql-formatter |
- LSP is `zls` (`lua/plugins/lspconfig.lua`), root markers `build.zig` /
`build.zig.zon`, with build-on-save and inlay hints.
- `zig build test` and project-wide neotest runs require a standard `test` step
in your `build.zig`; individual `.zig` files also work.
- Debugging needs `codelldb` (`:MasonInstall codelldb` if it doesn't
auto-install). Builds use `-O Debug` so symbols are present.
## Troubleshooting
### LSP not working
Run `:LspInfo` to check status. Run `:Mason` to verify tools are installed.
- **LSP not attaching:** `:checkhealth lsp` — confirm the server appears and is
attached (not just installed in Mason). If `root_dir`/`root_markers` look off,
the server may not find your project root.
- **Formatting:** `:ConformInfo`.
- **Tests not detected:** ensure the Treesitter parser for the language is
installed (`:TSInstall <lang>`); Zig needs a `test` step in `build.zig`.
- **Ctrl+Shift keys not firing:** some terminals don't transmit them; use the
plain-Ctrl fallbacks (`<C-v>` / `<C-x>` in the explorer).
- **Nerd Font icons missing:** install a Nerd Font and set it in your terminal.
### Formatting not working
Run `:ConformInfo` to check formatter status.
## Known issues (in current repo)
### Icons not displaying
Install a Nerd Font and configure your terminal to use it.
### Ctrl+Shift keybindings not working
Some terminals don't properly send Ctrl+Shift combinations. Use the alternative mappings (`<C-v>` and `<C-x>` in snacks explorer).
Two unrelated typos exist in `lua/config/keymaps.lua`'s opencode block (present
before these docs): the scroll-up command string reads `sesion.half.page.up`
(should be `session.…`), and `<leader>at` is mapped in `t` (terminal) mode where
`n`/`x` is likely intended. Documented here for accuracy; fix when convenient.

View File

@@ -2,6 +2,10 @@
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
-- ─────────────────────────────────────────────────────────────────────────────
-- General UX
-- ─────────────────────────────────────────────────────────────────────────────
-- Highlight on yank
augroup("YankHighlight", { clear = true })
autocmd("TextYankPost", {
@@ -72,13 +76,17 @@ autocmd("BufWritePre", {
end,
})
-- ─────────────────────────────────────────────────────────────────────────────
-- Filetype-specific settings
-- ─────────────────────────────────────────────────────────────────────────────
-- Set specific options for certain filetypes
augroup("FileTypeSettings", { clear = false })
augroup("FileTypeSettings", { clear = true })
-- Go files: use tabs
-- Go + Makefile files: use tabs
autocmd("FileType", {
group = "FileTypeSettings",
pattern = "go",
pattern = { "go", "make" },
callback = function()
vim.opt_local.expandtab = false
vim.opt_local.tabstop = 4
@@ -86,18 +94,7 @@ autocmd("FileType", {
end,
})
-- Makefile: use tabs
autocmd("FileType", {
group = "FileTypeSettings",
pattern = "make",
callback = function()
vim.opt_local.expandtab = false
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
end,
})
-- Markdown: enable wrap
-- Markdown: soft wrap + spell
autocmd("FileType", {
group = "FileTypeSettings",
pattern = "markdown",
@@ -107,6 +104,19 @@ autocmd("FileType", {
end,
})
-- SQL family: skip autoformat-on-save (LazyVim's pipeline respects vim.b.autoformat)
autocmd("FileType", {
group = "FileTypeSettings",
pattern = { "sql", "mysql", "plsql" },
callback = function()
vim.b.autoformat = false
end,
})
-- ─────────────────────────────────────────────────────────────────────────────
-- Project / tooling hints
-- ─────────────────────────────────────────────────────────────────────────────
autocmd("DirChanged", {
callback = function()
if vim.fn.filereadable(".devcontainer/devcontainer.json") == 1 then
@@ -122,21 +132,7 @@ autocmd("BufRead", {
local name = vim.fn.fnamemodify(args.file, ":t")
vim.notify(
"Generated " .. name .. ". Use: `go tool pprof -http=:0 " .. name .. "` or `go tool trace " .. name .. "`",
vim.log.levels.INFO)
vim.log.levels.INFO
)
end,
})
-- SQL files
-- autocmd("FileType", {
-- pattern = { "sql", "mysql", "plsql" },
-- callback = function()
-- local cmp = require("cmp")
-- cmp.setup.buffer({
-- sources = {
-- { name = "vim-dadbod" },
-- { name = "nvim_lsp" },
-- { name = "buffer" },
-- },
-- })
-- end,
-- })

View File

@@ -1,35 +1,34 @@
-- Custom keymaps
local map = vim.keymap.set
-- Terminal keymaps
-- <leader>th - Open terminal in horizontal split
map("n", "<leader>th", function()
-- ─────────────────────────────────────────────────────────────────────────────
-- Terminal
-- ─────────────────────────────────────────────────────────────────────────────
-- LazyVim uses <leader>t* for the Test group (neotest). Putting terminal
-- splits under capital <leader>T avoids that collision while staying mnemonic.
map("n", "<leader>Th", function()
vim.cmd("split | terminal")
vim.cmd("startinsert")
end, { desc = "Terminal (horizontal split)" })
-- <leader>tv - Open terminal in vertical split
map("n", "<leader>tv", function()
map("n", "<leader>Tv", function()
vim.cmd("vsplit | terminal")
vim.cmd("startinsert")
end, { desc = "Terminal (vertical split)" })
-- Terminal mode: Escape to normal mode
map("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- Explorer keymaps (Snacks explorer)
-- Ctrl+Shift+e - Toggle explorer
map("n", "<C-e>", function() Snacks.explorer() end, { desc = "Toggle Explorer" })
map("i", "<C-e>", function() Snacks.explorer() end, { desc = "Toggle Explorer" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Explorer (Snacks)
-- ─────────────────────────────────────────────────────────────────────────────
map({ "n", "i" }, "<C-e>", function()
Snacks.explorer()
end, { desc = "Toggle Explorer" })
-- Note: Ctrl+Shift+v and Ctrl+Shift+h for opening files in splits
-- are configured in the snacks picker config (lua/plugins/editor.lua)
-- as they need to work within the explorer buffer context
-- Additional useful keymaps
-- Better window navigation
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Window navigation
-- ─────────────────────────────────────────────────────────────────────────────
map("n", "<C-h>", "<C-w>h", { desc = "Go left window" })
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window" })
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window" })
@@ -40,75 +39,127 @@ map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" })
map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" })
map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" })
-- Buffer navigation
map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Buffers / editing
-- ─────────────────────────────────────────────────────────────────────────────
map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
-- Clear search highlight
map("n", "<Esc>", "<cmd>nohlsearch<cr>", { desc = "Clear search highlight" })
-- Save file
map({ "n", "i", "v", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
-- Better indenting in visual mode
map("v", "<", "<gv")
map("v", ">", ">gv")
map("v", "<", "<gv", { desc = "Indent left, keep selection" })
map("v", ">", ">gv", { desc = "Indent right, keep selection" })
-- Move lines up/down
map("n", "<A-j>", "<cmd>m .+1<cr>==", { desc = "Move line down" })
map("n", "<A-k>", "<cmd>m .-2<cr>==", { desc = "Move line up" })
map("v", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move selection down" })
map("v", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move selection up" })
map("n", "<A-j>", ":m '>+1<cr>gv=gv", { desc = "Move selection down" })
map("n", "<A-k>", ":m '<-2<cr>gv=gv", { desc = "Move selection up" })
-- Quick access to AI chat
map("n", "<leader>aa", "<cmd>AvanteAsk<cr>", { desc = "AI Ask" })
map("v", "<leader>aa", "<cmd>AvanteAsk<cr>", { desc = "AI Ask (selection)" })
map("n", "<leader>ac", "<cmd>AvanteChat<cr>", { desc = "AI Chat" })
map("n", "<leader>at", "<cmd>AvanteToggle<cr>", { desc = "AI Toggle" })
-- ─────────────────────────────────────────────────────────────────────────────
-- AI (OpenCode)
-- ─────────────────────────────────────────────────────────────────────────────
map({ "n", "x" }, "<leader>aa", function()
require("opencode").ask("@this: ", { submit = true })
end, { desc = "AI Ask" })
map({ "n", "x" }, "<leader>ax", function()
require("opencode").select()
end, { desc = "AI Ask (selection)" })
map({ "n", "t" }, "<leader>at", function()
require("opencode").toggle()
end, { desc = "AI Toggle" })
-- Database keymaps
map("n", "<leader>db", "<cmd>DBUIToggle<cr>", { desc = "Toggle DB UI" })
map("n", "<leader>da", "<cmd>DBUIAddConnection<cr>", { desc = "Add DB Connection" })
map({ "n", "x" }, "go", function()
return require("opencode").operator("@this ")
end, { desc = "Add range to AI chat", expr = true })
map("n", "goo", function()
return require("opencode").operator("@this ") .. "_"
end, { desc = "Add line to AI chat", expr = true })
-- Neotest
local neotest = require("neotest")
map("n", "<S-C-u>", function()
require("opencode").command("sesion.half.page.up")
end, { desc = "Scroll AI chat up" })
map("n", "<S-C-d>", function()
require("opencode").command("session.half.page.down")
end, { desc = "Scroll AI chat down" })
map("n", "<leader>tt", neotest.run.run, { desc = "Run nearest test" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Database (vim-dadbod)
-- ─────────────────────────────────────────────────────────────────────────────
-- Moved off <leader>db to free that for the DAP breakpoint default.
map("n", "<leader>Du", "<cmd>DBUIToggle<cr>", { desc = "Toggle DB UI" })
map("n", "<leader>Da", "<cmd>DBUIAddConnection<cr>", { desc = "Add DB Connection" })
map("n", "<leader>Df", "<cmd>DBUIFindBuffer<cr>", { desc = "Find DB Buffer" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Tests (neotest)
-- ─────────────────────────────────────────────────────────────────────────────
-- IMPORTANT: do NOT `require("neotest")` at module top — it eager-loads the
-- plugin on every startup. Wrap each binding in a function so the require
-- happens at keypress time, letting Lazy.nvim load on demand.
map("n", "<leader>tt", function()
require("neotest").run.run()
end, { desc = "Run nearest test" })
map("n", "<leader>tf", function()
neotest.run.run(vim.fn.expand("%"))
require("neotest").run.run(vim.fn.expand("%"))
end, { desc = "Run test file" })
map("n", "<leader>ts", neotest.summary.toggle)
map("n", "<leader>to", neotest.output.open)
map("n", "<leader>ts", function()
require("neotest").summary.toggle()
end, { desc = "Toggle test summary" })
map("n", "<leader>to", function()
require("neotest").output.open()
end, { desc = "Open test output" })
map("n", "<leader>tc", "<cmd>Coverage<cr>", { desc = "Show coverage" })
-- Go benchmark
map("n", "<leader>gb", function()
-- ─────────────────────────────────────────────────────────────────────────────
-- Go: benchmarks & profiling
-- ─────────────────────────────────────────────────────────────────────────────
-- Using <leader>cg* (Code > Go) to avoid colliding with Git's <leader>g group.
map("n", "<leader>cgb", function()
vim.cmd("!go test -bench=. -benchmem ./...")
end, { desc = "Go benchmarks" })
map("n", "<leader>gpc", function()
map("n", "<leader>cgpc", function()
vim.cmd("!go test -run=^$ -bench=. -cpuprofile cpu.out ./...")
end, { desc = "Go CPU profile" })
map("n", "<leadger>gpm", function()
map("n", "<leader>cgpm", function()
vim.cmd("!go test -run=^$ -bench=. -memprofile mem.out ./...")
end, { desc = "Go memory profile" })
map("n", "<leader>gpt", function()
vim.cmd("!go test -run=^$ -bench. -trace trace.out ./...")
map("n", "<leader>cgpt", function()
vim.cmd("!go test -run=^$ -bench=. -trace trace.out ./...")
end, { desc = "Go trace profile" })
-- Overseer
map("n", "<leader>or", "<cmd>OverseerRun<cr>", { desc = "Run task" })
map("n", "<leader>ot", "<cmd>OverseerToogle<cr>", { desc = "Task list" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Zig: build / run / test
-- ─────────────────────────────────────────────────────────────────────────────
-- Mirrors the Go <leader>cg* layout: <leader>cz* (Code > Zig).
-- These are quick one-shot runs; for the mouse-driven task picker use <leader>or (OverseerRun),
-- which lists the zig: build/run/test templates from lua/overseer/template/user
map("n", "<leader>czb", "<cmd>!zig build<cr>", { desc = "Zig build" })
map("n", "<leader>czr", "<cmd>!zig build run<cr>", { desc = "Zig build run" })
map("n", "<leader>czt", "<cmd>!zig build test<cr>", { desc = "Zig build test" })
-- Aerial
-- ─────────────────────────────────────────────────────────────────────────────
-- Overseer
-- ─────────────────────────────────────────────────────────────────────────────
map("n", "<leader>or", "<cmd>OverseerRun<cr>", { desc = "Run task" })
map("n", "<leader>ot", "<cmd>OverseerToggle<cr>", { desc = "Task list" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Symbols / outline
-- ─────────────────────────────────────────────────────────────────────────────
map("n", "<leader>so", "<cmd>AerialToggle<cr>", { desc = "Symbols outline" })
map("n", "<leader>sh", vim.lsp.buf.incoming_calls, { desc = "Incoming calls" })
map("n", "<leader>sc", vim.lsp.buf.outgoing_calls, { desc = "Outgoing calls" })
-- Diagnostics
map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>")
map("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>")
map("n", "<leader>xt", "<cmd>Trouble todo<cr>")
-- ─────────────────────────────────────────────────────────────────────────────
-- Diagnostics (Trouble)
-- ─────────────────────────────────────────────────────────────────────────────
map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", { desc = "Diagnostics (Trouble)" })
map("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>", { desc = "Workspace diagnostics" })
map("n", "<leader>xt", "<cmd>Trouble todo<cr>", { desc = "TODOs (Trouble)" })
-- Git Support
map("n", "<leader>gg", "<cmd>Neogit<cr>", { desc = "Neogit" })
-- ─────────────────────────────────────────────────────────────────────────────
-- Git
-- ─────────────────────────────────────────────────────────────────────────────
-- LazyVim's <leader>gg is lazygit by default; mapping Neogit to <leader>gn.
map("n", "<leader>gn", "<cmd>Neogit<cr>", { desc = "Neogit" })

View File

@@ -10,33 +10,33 @@ end
-- General
opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.confirm = true -- Confirm before closing unsaved buffer
opt.cursorline = true -- Highlight current line
opt.mouse = "a" -- Enable mouse
opt.number = true -- Show line numbers
opt.relativenumber = true -- Relative line numbers
opt.signcolumn = "yes" -- Always show sign column
opt.termguicolors = true -- True color support
opt.wrap = false -- Disable line wrap
opt.confirm = true -- Confirm before closing unsaved buffer
opt.cursorline = true -- Highlight current line
opt.mouse = "a" -- Enable mouse
opt.number = true -- Show line numbers
opt.relativenumber = true -- Relative line numbers
opt.signcolumn = "yes" -- Always show sign column
opt.termguicolors = true -- True color support
opt.wrap = true -- Enable line wrap
-- Indentation
opt.expandtab = true -- Use spaces instead of tabs
opt.shiftwidth = 2 -- Size of indent
opt.tabstop = 2 -- Number of spaces tabs count for
opt.expandtab = true -- Use spaces instead of tabs
opt.shiftwidth = 2 -- Size of indent
opt.tabstop = 4 -- Number of spaces tabs count for
opt.smartindent = true -- Smart indentation
-- Search
opt.ignorecase = true -- Ignore case
opt.smartcase = true -- Don't ignore case with capitals
opt.hlsearch = true -- Highlight search results
opt.incsearch = true -- Show search results as you type
opt.smartcase = true -- Don't ignore case with capitals
opt.hlsearch = true -- Highlight search results
opt.incsearch = true -- Show search results as you type
-- Split behavior
opt.splitbelow = true -- Put new windows below current
opt.splitright = true -- Put new windows right of current
-- Undo
opt.undofile = true -- Persistent undo
opt.undofile = true -- Persistent undo
opt.undolevels = 10000 -- Maximum undo levels
-- Performance

View File

@@ -0,0 +1,21 @@
return {
name = "zig: build",
desc = "Build the project (zig build)",
-- Only offered as a task when a build.zig is present in the project root.
condition = {
callback = function()
return vim.fn.filereadable(vim.fn.getcwd() .. "/build.zig") == 1
end,
},
builder = function()
return {
cmd = { "zig" },
args = { "build" },
components = {
"default",
"on_output_quickfix",
{ "on_complete_notify", statuses = { "SUCCESS", "FAILURE" } },
},
}
end,
}

View File

@@ -0,0 +1,20 @@
return {
name = "zig: run",
desc = "Build and run (zig build run)",
condition = {
callback = function()
return vim.fn.filereadable(vim.fn.getcwd() .. "/build.zig") == 1
end,
},
builder = function()
return {
cmd = { "zig" },
args = { "build", "run" },
components = {
"default",
"on_output_quickfix",
{ "on_complete_notify", statuses = { "SUCCESS", "FAILURE" } },
},
}
end,
}

View File

@@ -0,0 +1,20 @@
return {
name = "zig: test",
desc = "Run the test step (zig build test)",
condition = {
callback = function()
return vim.fn.filereadable(vim.fn.getcwd() .. "/build.zig") == 1
end,
},
builder = function()
return {
cmd = { "zig" },
args = { "build", "test" },
components = {
"default",
"on_output_quickfix",
{ "on_complete_notify", statuses = { "SUCCESS", "FAILURE" } },
},
}
end,
}

View File

@@ -1,213 +1,65 @@
-- AI Chat Integration using avante.nvim
-- Supports: Anthropic Claude, OpenAI, Google Gemini, Copilot, and more
-- API keys via environment variables:
-- ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY
-- Or scoped: AVANTE_ANTHROPIC_API_KEY, AVANTE_OPENAI_API_KEY, etc.
return {
{
"yetone/avante.nvim",
event = "VeryLazy",
version = false, -- Never set to "*"
build = "make",
"nickjvandyke/opencode.nvim",
version = "v0.10.1",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
{
-- Image support (optional)
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
---@module "snacks"
"folke/snacks.nvim",
optional = true,
opts = {
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
input = {}, -- Enhances `ask()`
picker = { -- Enhances `select()`
actions = {
opencode_send = function(...)
return require("opencode").snacks_picker_send(...)
end,
},
win = {
input = {
keys = {
["<a-a>"] = { "opencode_send", mode = { "n", "i" } },
},
},
},
},
},
},
{
-- Markdown rendering in Avante
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
---@module 'avante'
---@type avante.Config
opts = {
-- Default provider (switch with :AvanteProvider command)
-- Options: "claude", "openai", "azure", "gemini", "copilot", "cohere"
provider = "openai",
config = function()
local opencode_cmd = "opencode --port"
---@type snacks.terminal.Opts
local snacks_terminal_opts = {
win = {
position = "right",
enter = false,
on_win = function(win)
-- Set up keymaps and cleanup for an arbitary terminal
require("opencode.terminal").setup(win.win)
end,
},
}
-- Provider configurations
providers = {
claude = {
endpoint = "https://api.anthropic.com",
model = "claude-sonnet-4-5-20250929",
timeout = 30000,
extra_request_body = {
temperature = 0.75,
max_tokens = 20480,
},
---@type opencode.Opts
vim.g.opencode_opts = {
-- Specific configuration around opencode
server = {
start = function()
require("snacks.terminal").open(opencode_cmd, snacks_terminal_opts)
end,
stop = function()
require("snacks.terminal").get(opencode_cmd, snacks_terminal_opts):close()
end,
toggle = function()
require("snacks.terminal").toggle(opencode_cmd, snacks_terminal_opts)
end,
},
openai = {
endpoint = "https://api.openai.com/v1",
model = "gpt-4o-mini",
timeout = 30000,
extra_request_body = {
temperature = 0.75,
max_completion_tokens = 16384,
},
},
azure = {
endpoint = "", -- e.g., "https://<resource>.openai.azure.com"
deployment = "", -- Azure deployment name
api_version = "2024-12-01-preview",
timeout = 30000,
extra_request_body = {
temperature = 0.75,
max_completion_tokens = 16384,
},
},
gemini = {
endpoint = "https://generativelanguage.googleapis.com/v1beta/models",
model = "gemini-2.0-flash",
timeout = 30000,
extra_request_body = {
generationConfig = {
temperature = 0.75,
},
},
},
copilot = {
endpoint = "https://api.githubcopilot.com",
model = "gpt-4o-2024-08-06",
timeout = 30000,
extra_request_body = {
temperature = 0.75,
max_tokens = 20480,
},
},
-- Custom provider example for Ollama (local models)
-- Uncomment and configure if using local LLMs
-- ollama = {
-- __inherited_from = "openai",
-- endpoint = "http://localhost:11434/v1",
-- model = "llama3.2",
-- api_key_name = "",
-- },
},
-- Behavior settings
behaviour = {
auto_suggestions = false, -- Set true for copilot-like suggestions
auto_set_highlight_group = true,
auto_set_keymaps = true,
auto_apply_diff_after_generation = false,
support_paste_from_clipboard = false,
minimize_diff = true,
enable_token_counting = true,
},
-- Mappings
mappings = {
diff = {
ours = "co",
theirs = "ct",
all_theirs = "ca",
both = "cb",
cursor = "cc",
next = "]x",
prev = "[x",
},
suggestion = {
accept = "<M-l>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
jump = {
next = "]]",
prev = "[[",
},
submit = {
normal = "<CR>",
insert = "<C-s>",
},
sidebar = {
apply_all = "A",
apply_cursor = "a",
switch_windows = "<Tab>",
reverse_switch_windows = "<S-Tab>",
},
},
-- Hints shown in the UI
hints = { enabled = true },
-- Window configuration
windows = {
position = "right",
wrap = true,
width = 30,
sidebar_header = {
lsp = {
enabled = true,
align = "center",
rounded = true,
},
input = {
prefix = "> ",
height = 8,
},
edit = {
border = "rounded",
start_insert = true,
},
ask = {
floating = false,
start_insert = true,
border = "rounded",
},
},
}
-- Highlight groups
highlights = {
diff = {
current = "DiffText",
incoming = "DiffAdd",
},
},
-- Diff settings
diff = {
autojump = true,
list_opener = "copen",
override_timeoutlen = 500,
},
},
vim.o.autoread = true -- Required for `opts.events.reload`
end,
},
-- {
-- "zbirenbaum/copilot.lua",
-- cmd = "Copilot",
-- event = "InsertEnter",
-- opts = {
-- suggestion = {
-- enabled = true,
-- auto_trigger = true,
-- keymap = {
-- accept = "<C-l>",
-- next = "<C-n>",
-- prev = "<C-p>",
-- },
-- },
-- panel = { enabled = false },
-- },
-- }
}

View File

@@ -1,5 +1,11 @@
-- Database integration with vim-dadbod
-- Supports PostgreSQL, MySQL, SQLite, and more
-- All three plugins are lazy-loaded:
-- - vim-dadbod loads on :DB / :DBUI* commands
-- - dadbod-ui loads on its own UI commands
-- dadbod-completion loads on sql/mysql/plsql filetypes
--
-- Keymaps live in config/keymaps.lua under the <leader>D group.
return {
-- Core dadbod plugin
@@ -13,8 +19,8 @@ return {
"kristijanhusak/vim-dadbod-ui",
cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
dependencies = {
{ "tpope/vim-dadbod", lazy = true },
{ "kristijanhusak/vim-dadbod-completion", ft = { 'sql', 'mysql', 'plsql' }, lazy = true },
"tpope/vim-dadbod",
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" } },
},
init = function()
-- UI configuration
@@ -44,19 +50,18 @@ return {
-- Completion
{
'saghen/blink.cmp',
"saghen/blink.cmp",
opts = {
sources = {
default = { "lsp", "path", "snippets", "buffer" },
per_filetype = {
sql = { 'snippets', 'dadbod', 'buffer' },
sql = { "snippets", "dadbod", "buffer" },
},
-- add vim-dadbod-completion to your completion providers
providers = {
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink"}
}
}
}
}
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
},
},
},
},
}

View File

@@ -1,115 +1,271 @@
-- Debug Adapter Protocol (DAP) configuration for Go
-- Debug Adapter Protocol (DAP) configuration for Go & JS
-- Uses delve for Go debugging
-- Loads only when a <leader>d* key is pressed (see keys = {...} below).
return {
-- nvim-dap configuration
-- ─────────────────────────────────────────────────────────────────────────
-- Core DAP + Go adapter + UI extras
-- ─────────────────────────────────────────────────────────────────────────
{
"mfussenegger/nvim-dap",
dependencies = {
-- Go-specific DAP configuration
-- Fold these under nvim-dap so they share its keys-based lazy trigger
-- instead of loading eagerly at startup.
{ "rcarriga/nvim-dap-ui", dependencies = { "nvim-neotest/nvim-nio" } },
"theHamsta/nvim-dap-virtual-text",
"jay-babu/mason-nvim-dap.nvim",
{
"leoluz/nvim-dap-go",
opts = {
-- Delve configurations
delve = {
-- Path to delve (uses Mason-installed by default)
path = "dlv",
-- Initialize with default args
initialize_timeout_sec = 20,
-- Whether to use debug adapter mode
port = "${port}",
-- Build flags for delve
build_flags = "",
},
-- DAP configurations for Go
dap_configurations = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${file}",
-- IMPORTANT: opts is a FUNCTION, not a table literal.
-- The attach config references require("dap.utils"), which must not run until
-- nvim-dap is actually loaded.
opts = function()
return {
delve = {
path = "dlv",
initialize_timeout_sec = 20,
port = "${port}",
build_flags = "",
},
{
type = "go",
name = "Debug Package",
request = "launch",
program = "${fileDirname}",
dap_configurations = {
{ type = "go", name = "Debug", request = "launch", program = "${file}" },
{ type = "go", name = "Debug Test", request = "launch", program = "${file}" },
{ type = "go", name = "Debug Package", request = "launch", program = "${filDirname}" },
{
type = "go",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}",
},
{
type = "go",
name = "Attach",
request = "attach",
mode = "local",
processId = require("dap.utils").pick_process,
},
},
{
type = "go",
name = "Debug test",
request = "launch",
mode = "test",
program = "${file}",
},
{
type = "go",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}",
},
{
type = "go",
name = "Attach",
request = "attach",
mode = "local",
processId = require("dap.utils").pick_process,
},
},
},
}
end,
},
},
keys = {
-- Debug keymaps
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, desc = "Breakpoint Condition" },
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
{
"<leader>dB",
function()
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
end,
desc = "Breakpoint Condition",
},
{
"<leader>db",
function()
require("dap").toggle_breakpoint()
end,
desc = "Toggle Breakpoint",
},
{
"<leader>dc",
function()
require("dap").continue()
end,
desc = "Continue",
},
{
"<leader>dC",
function()
require("dap").run_to_cursor()
end,
desc = "Run to Cursor",
},
{
"<leader>dg",
function()
require("dap").goto_()
end,
desc = "Go to Line (No Execute)",
},
{
"<leader>di",
function()
require("dap").step_into()
end,
desc = "Step Into",
},
{
"<leader>dj",
function()
require("dap").down()
end,
desc = "Down",
},
{
"<leader>dk",
function()
require("dap").up()
end,
desc = "Up",
},
{
"<leader>dO",
function()
require("dap").step_over()
end,
desc = "Step Over",
},
{
"<leader>dp",
function()
require("dap").pause()
end,
desc = "Pause",
},
{
"<leader>dr",
function()
require("dap").repl.toggle()
end,
desc = "Toggle REPL",
},
{
"<leader>ds",
function()
require("dap").session()
end,
desc = "Session",
},
{
"<leader>dt",
function()
require("dap").terminate()
end,
desc = "Terminate",
},
{
"<leader>dw",
function()
require("dap.ui.widgets").hover()
end,
desc = "Widgets",
},
-- Go-specific
{ "<leader>dT", function() require("dap-go").debug_test() end, desc = "Debug Go Test" },
{ "<leader>dL", function() require("dap-go").debug_last_test() end, desc = "Debug Last Go Test" },
{
"<leader>dT",
function()
require("dap-go").debug_test()
end,
desc = "Debug Go Test",
},
{
"<leader>dL",
function()
require("dap-go").debug_last_test()
end,
desc = "Debug Last Go Test",
},
},
},
-- DAP UI for better debugging experience
-- -------------------------------------------------------------------------
-- Zig (+ C/C++) debugging via codelldb
-- -------------------------------------------------------------------------
{
"mfussenegger/nvim-dap",
ft = { "zig" },
config = function()
local dap = require("dap")
-- Prefer codelldb on $PATH, fall back to Mason's install location
local codelldb = vim.fn.exepath("codelldb")
if codelldb == "" then
codelldb = vim.fn.stdpath("data") .. "/mason/bin/codelldb"
end
dap.adapters.codelldb = {
type = "server",
port = "${port}",
executable = {
command = codelldb,
args = { "--port", "${port}" },
},
}
dap.configurations.zig = {
{
-- Project build (build.zig). Runs `zig build` first so a fresh
-- debug binary exists, then asks which exec under zig-out/bin to run.
name = "Launch (zig build)",
type = "codelldb",
request = "launch",
program = function()
vim.fn.system({ "zig", "build", "--summary", "none" })
return vim.fn.input("Executable: ", vim.fn.getcwd() .. "/zig-out/bin/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
},
{
-- Single file. Compiles the current .zig with debug info next to it,
-- then launches that binary.
name = "Launch (current file)",
type = "codelldb",
request = "launch",
program = function()
local src = vim.fn.expand("%:p")
local out = vim.fn.expand("%:p:r")
vim.fn.system({ "zig", "build-exe", src, "-O", "Debug", "-femit-bin=" .. out })
return out
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
},
}
-- Reuse the same configs for C/C++ buffers - codelldb handles them too
dap.configurations.c = dap.configurations.zig
dap.configurations.cpp = dap.configurations.zig
end,
},
-- ─────────────────────────────────────────────────────────────────────────
-- DAP UI keymaps + auto open/close (the spec itself is loaded as a dep above)
-- ─────────────────────────────────────────────────────────────────────────
{
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
keys = {
{ "<leader>du", function() require("dapui").toggle({}) end, desc = "Dap UI" },
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = { "n", "v" } },
{
"<leader>du",
function()
require("dapui").toggle({})
end,
desc = "Dap UI",
},
{
"<leader>de",
function()
require("dapui").eval()
end,
desc = "Eval",
mode = { "n", "v" },
},
},
opts = {
layouts = {
{
elements = {
{ id = "scopes", size = 0.25 },
{ id = "scopes", size = 0.25 },
{ id = "breakpoints", size = 0.25 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 0.25 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 0.25 },
},
position = "left",
size = 40,
},
{
elements = {
{ id = "repl", size = 0.5 },
{ id = "repl", size = 0.5 },
{ id = "console", size = 0.5 },
},
position = "bottom",
@@ -122,8 +278,7 @@ return {
local dapui = require("dapui")
dapui.setup(opts)
-- Auto open/close DAP UI
-- Auto open/close DAP UI on debug session start/end
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
end
@@ -135,17 +290,24 @@ return {
end
end,
},
-- ─────────────────────────────────────────────────────────────────────────
-- mason-nvim-dap: install DAP adapters via Mason
-- ─────────────────────────────────────────────────────────────────────────
-- Note: delve and js-debug-adapter are also listed in mason.lua's
-- ensure_installed (under "DAP adapters"). Either source
-- can install them; mason-nvim-dap is preferred when present because it also
-- auto-registers the adapters with nvim-dap.
{
"jay-babu/mason-nvim-dap.nvim",
opts = {
ensure_installed = {
"python",
"delve",
"js"
},
ensure_installed = { "python", "delve", "js", "codelldb" },
},
},
-- Virtual text for debugging
-- ─────────────────────────────────────────────────────────────────────────
-- Inline variable values during debug sessions
-- ─────────────────────────────────────────────────────────────────────────
{
"theHamsta/nvim-dap-virtual-text",
opts = {

View File

@@ -1,32 +1,19 @@
-- Editor enhancements - Snacks explorer configuration
-- Custom keybindings for file explorer (snacks.nvim built into LazyVim)
--
-- LazyVim provides snacks (explorer, picker, lazygit, terminal), native
-- commenting (Neovim 0.10+), and mini.hipatterns for color preview.
-- This file only adds project-specific overrides on top.
return {
{
"nvim-telescope/telescope.nvim",
opts = {
defaults = {
hidden = true,
file_ignore_patterns = {},
},
pickers = {
find_files = {
hidden = true,
no_ignore = true,
no_ignore_parent = true,
},
live_grep = {
additional_args = function()
return { "--hidden", "--no-ignore" }
end,
},
},
},
},
-- Configure snacks.nvim explorer (already included in LazyVim)
-- ─────────────────────────────────────────────────────────────────────────
-- Snacks: explorer + picker tweaks
-- ─────────────────────────────────────────────────────────────────────────
{
"folke/snacks.nvim",
opts = {
quickfile = {
enabled = true,
},
explorer = {
replace_netrw = true,
},
@@ -34,21 +21,21 @@ return {
enabled = true,
},
picker = {
enabled = true,
ui_select = true,
sources = {
explorer = {
-- Explorer picker configuration
hidden = true,
ignored = true, -- Show files ignored by .gitignore
ignored = true, -- show .gitignore files too
follow_file = true,
-- Custom keymaps within the explorer
win = {
list = {
keys = {
-- Ctrl+Shift+v - Open in vertical split
-- Ctrl+Shift versions (work in Kitty/WezTerm/Alacritty with the right config)
["<C-S-v>"] = { "edit_vsplit", mode = { "n", "i" } },
-- Ctrl+Shift+h - Open in horizontal split
["<C-S-h>"] = { "edit_split", mode = { "n", "i" } },
-- Alternative mappings (in case terminal doesn't send Ctrl+Shift properly)
-- Plain Ctrl fallbacks for terminals that don't transmit
-- the Shift modifier seperately
["<C-v>"] = { "edit_vsplit", mode = { "n", "i" } },
["<C-x>"] = { "edit_split", mode = { "n", "i" } },
},
@@ -59,134 +46,48 @@ return {
},
},
keys = {
-- Ctrl+Shift+e - Toggle explorer
{ "<C-S-e>", function() Snacks.explorer() end, desc = "Toggle Explorer" },
-- Alternative binding if terminal doesn't handle Ctrl+Shift
{ "<leader>fe", function() Snacks.explorer() end, desc = "File Explorer" },
-- Lazygit
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
{ "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log" },
{ "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit File History" },
-- Optional Lazygit log/file-history shortcuts - LazyVim's <leader>gg
-- already opens lazygit itself.
{
"<leader>gl",
function()
Snacks.lazygit.log()
end,
desc = "Lazygit Log",
},
{
"<leader>gf",
function()
Snacks.lazygit.log_file()
end,
desc = "Lazygit File History",
},
},
},
-- Which-key for keybinding hints
-- ─────────────────────────────────────────────────────────────────────────
-- Which-key: leader-prefix cheat sheet
-- ─────────────────────────────────────────────────────────────────────────
-- Hold <leader> for ~300ms (timeoutlen) and the group menu appears.
{
"folke/which-key.nvim",
opts = {
spec = {
{ "<leader>a", group = "AI" },
{ "<leader>d", group = "Debug/Database" },
{ "<leader>b", group = "Buffer" },
{ "<leader>c", group = "Code" },
{ "<leader>cg", group = "Go" },
{ "<leader>cgp", group = "Profile" },
{ "<leader>cz", group = "Zig" },
{ "<leader>d", group = "Debug" },
{ "<leader>D", group = "Database" },
{ "<leader>f", group = "Find" },
{ "<leader>g", group = "Git" },
{ "<leader>t", group = "Terminal" },
},
},
},
-- Color preview for CSS, HTML, etc.
{
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
opts = {
filetypes = {
"css",
"scss",
"sass",
"less",
"html",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"vue",
"svelte",
"lua",
"yaml",
"toml",
"conf",
},
user_default_options = {
RGB = true,
RRGGBB = true,
RRGGBBAA = true,
names = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
mode = "background",
tailwind = false,
sass = { enable = true, parsers = { "css" } },
virtualtext = "",
always_update = true, -- Update color values even if buffer is not focused
},
},
},
-- Better terminal integration
{
"akinsho/toggleterm.nvim",
version = "*",
opts = {
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
},
},
-- Help comment and uncomment lines
{
'numToStr/Comment.nvim',
opts = {
padding = true,
-- LHS of toggle mappings in NORMAL mode
toggler = {
line = 'gcc',
block = 'gbc',
},
-- LHS of operator-pending mappings in NORMAL and VISUAL
opleader = {
line = "gc",
block = "gb",
},
-- LHS of extra mappings
extra = {
-- Add comment on the line above
above = 'gcO',
-- Add comment on the line below
below = 'gco',
-- Add comment at the end of line
eol = 'gcA',
},
mappings = {
basic = true,
extra = true,
{ "<leader>o", group = "Overseer" },
{ "<leader>s", group = "Search / Symbols" },
{ "<leader>t", group = "Test" },
{ "<leader>T", group = "Terminal" },
{ "<leader>u", group = "UI / Toggle" },
{ "<leader>x", group = "Diagnostics" },
},
},
},

View File

@@ -1,23 +1,22 @@
-- Formatting configuration with conform.nvim
-- Autoformat on save with per-filetype formatters
--
-- LazyVim owns format-on-save: it registers conform via LazyVim.format.register()
-- and triggers a BufWritePre autocmd gated on vim.g.autoformat / vim.b.autoformat.
-- Do NOT set format_on_save here - it bypasses that pipeline.
--
-- Controls:
-- :LazyFormat format current buffer now
-- <leader>cf format buffer (LazyVim default)
-- <leader>uf toggle autoformat for this buffer
-- <leader>uF toggle autoformat globally
--
-- Per-filetype skip is done from autocmd.lua via `vim.b.autofmrat = false`.
return {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>cf",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = { "n", "v" },
desc = "Format buffer",
},
},
opts = {
-- Formatters by filetype
formatters_by_ft = {
-- Go
go = { "gofumpt", "goimports" },
@@ -25,7 +24,7 @@ return {
-- Lua
lua = { "stylua" },
-- JavaScript/TypeScript
-- Javascript / Typescript
javascript = { "prettier" },
javascriptreact = { "prettier" },
typescript = { "prettier" },
@@ -36,102 +35,37 @@ return {
css = { "prettier" },
scss = { "prettier" },
-- Data formats
-- Data
json = { "prettier" },
jsonc = { "prettier" },
yaml = { "prettier" },
toml = { "prettier" },
-- Markdown
markdown = { "prettier" },
["markdown.mdx"] = { "prettier" },
-- SQL
sql = { "sql_formatter", "sqlfluff", "pg_format" },
mysql = { "sql_formatter", "sqlfluff" },
plsql = { "sql_formatter", "sqlfluff", "pg_format" },
-- Makefile (no formatter - they require tabs)
-- make = {},
-- Fallback for all other filetypes
["_"] = { "trim_whitespace" },
-- SQL - manual format only, autoformat skipped in autocmds.lua
sql = { "sql_formatter" },
mysql = { "sql_formatter" },
plsql = { "sql_formatter" },
},
-- Format on save
format_on_save = function(bufnr)
-- Disable for certain filetypes
local ignore_filetypes = { "sql", "mysql", "plsql" }
if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then
return
end
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return {
timeout_ms = 3000,
lsp_fallback = true,
}
end,
-- Formatter options
-- Per-formatter argument tweaks (merged with LazyVim defaults)
formatters = {
-- Stylua configuration
stylua = {
prepend_args = { "--indent-type", "Spaces", "--indent-width", "2" },
},
-- Prettier configuration
prettier = {
prepend_args = { "--tab-width", "2", "--single-quote" },
},
-- SQL formatter configuration
sql_formatter = {
prepend_args = { "--language", "postgresql" },
},
-- goimports configuration
goimports = {
prepend_args = { "-local", "github.com" },
},
},
},
init = function()
-- Commands to toggle format on save
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
vim.notify("Autoformat disabled", vim.log.levels.INFO)
end, {
desc = "Disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
vim.notify("Autoformat enabled", vim.log.levels.INFO)
end, {
desc = "Re-enable autoformat-on-save",
})
vim.api.nvim_create_user_command("FormatToggle", function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
vim.notify("Autoformat disabled", vim.log.levels.INFO)
else
vim.notify("Autoformat enabled", vim.log.levels.INFO)
end
end, {
desc = "Toggle autoformat-on-save",
})
end,
},
}

View File

@@ -1,6 +1,19 @@
-- nvim-coverage: show test coverage gutter signs.
-- Loads when opening Go files or when a Coverage* command is invoked.
return {
{
"andythigpen/nvim-coverage",
ft = "go",
cmd = {
"Coverage",
"CoverageLoad",
"CoverageShow",
"CoverageHide",
"CoverageToggle",
"CoverageClear",
"CoverageSummary",
},
dependencies = "nvim-lua/plenary.nvim",
config = true,
},

View File

@@ -1,243 +0,0 @@
-- LSP Configuration
-- Extends LazyVim's built-in LSP support
-- Helper function for monorepo root detection
-- Finds nearest project marker, with fallback to git root
local function make_root_detector(markers)
return function(fname)
local util = require("lspconfig.util")
-- First try language-specific markers (nearest to file)
local root = util.root_pattern(unpack(markers))(fname)
if root then
return root
end
-- Fallback to git root
return util.root_pattern(".git")(fname)
end
end
return {
-- Mason: manage LSP servers, linters, formatters
{
"mason-org/mason.nvim",
opts = {
ensure_installed = {
-- LSP servers
"gopls", -- Go
"lua-language-server", -- Lua
"typescript-language-server", -- TypeScript/JavaScript
"js-debug-adapter", -- JS
"html-lsp", -- HTML
"css-lsp", -- CSS
"json-lsp", -- JSON
"yaml-language-server", -- YAML
"marksman", -- Markdown
"sqlls", -- SQL
"pyright", --Python
"ruff", --Python
"docker-language-server", -- Docker
"zls", -- Zig
-- Linters
"golangci-lint",
"eslint_d",
"markdownlint",
"hadolint",
"shellcheck",
-- Formatters
"gofumpt",
"goimports",
"prettier",
"stylua",
"sql-formatter",
-- DAP
"delve", -- Go debugger
},
},
},
-- LSP configuration
{
"neovim/nvim-lspconfig",
opts = {
servers = {
-- Go
gopls = {
-- Root detection: find go.work first, then go.mod, then git root
-- root_dir = make_root_detector({ "go.work", "go.mod" }),
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
semanticTokens = true,
-- Monorepo/workspace support
expandWorkspaceToModule = true,
experimentalPostfixCompletions = true,
-- Handle multiple modules
["build.standaloneTags"] = { "ignore" },
},
},
},
-- Lua
lua_ls = {
root_dir = make_root_detector({ ".luarc.json", ".luarc.jsonc", ".luacheckrc", ".stylua.toml", "stylua.toml",
"selene.toml", "selene.yml" }),
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
diagnostics = {
globals = { "vim" },
},
},
},
},
-- TypeScript/JavaScript
ts_ls = {
-- Root detection: find nearest tsconfig/package.json
root_dir = make_root_detector({ "tsconfig.json", "jsconfig.json", "package.json" }),
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
},
-- HTML
html = {
root_dir = make_root_detector({ "package.json", ".git" }),
filetypes = { "html", "templ" },
},
-- CSS
cssls = {
root_dir = make_root_detector({ "package.json", ".git" }),
},
-- JSON
jsonls = {
root_dir = make_root_detector({ "package.json", ".git" }),
},
-- YAML
yamlls = {
root_dir = make_root_detector({ "package.json", ".git" }),
settings = {
yaml = {
keyOrdering = false,
schemas = {
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
["https://json.schemastore.org/docker-compose.json"] = "docker-compose*.yml",
},
},
},
},
-- Markdown
marksman = {
root_dir = make_root_detector({ ".marksman.toml", ".git" }),
},
-- SQL
sqlls = {
root_dir = make_root_detector({ ".sqllsrc.json", "sqlls.json", ".git" }),
},
-- Docker
dockerls = {},
docker_compose_language_server = {},
},
},
},
-- Treesitter for better syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"go",
"gomod",
"gowork",
"gosum",
"lua",
"luadoc",
"typescript",
"javascript",
"tsx",
"html",
"css",
"json",
"jsonc",
"yaml",
"markdown",
"markdown_inline",
"ninja",
"sql",
"make",
"vim",
"vimdoc",
"bash",
"regex",
"diff",
"gitcommit",
"git_rebase",
"dockerfile",
},
highlight = { enable = true },
indent = { enable = true },
},
},
}

182
lua/plugins/lspconfig.lua Normal file
View File

@@ -0,0 +1,182 @@
-- LSP server configurations
-- Extends LazyVim's nvim-lspconfig setup via opts.servers.
--
-- Uses `root_markers` (Neovim 0.11+ vim.lsp.config API) instead of a custom
-- root_dir function. root_markers is a list of filenames that, when found
-- walking upward from the buffer, identify the workspace root. `.git` is
-- always listed last as a fallback.
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
-- -----------------------------------------------------------------
-- Go
-- -----------------------------------------------------------------
gopls = {
root_markers = { "go.work", "go.mod", ".git" },
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
semanticTokens = true,
expandWorkspaceToModule = true,
experimentalPostfixCompletions = true,
["build.standaloneTags"] = { "ignore" },
},
},
cmd_env = {
GOEXPERIMENT = "jsonv2",
},
},
-- -----------------------------------------------------------------
-- Zig
-- -----------------------------------------------------------------
zig = {
root_markers = { "build.zig", "build.zig.zon" },
settings = {
zls = {
enable_build_on_save = true,
-- "watch" or specify a step name your build.zig defines
build_on_save_step = "install",
semantic_tokens = "full",
enable_inlay_hints = true,
inlay_hints_show_parameter_name = true,
inlay_hints_show_builtin = true,
inlay_hints_show_variable_type_hints = true,
warn_style = true,
},
},
},
-- -----------------------------------------------------------------
-- Lua
-- -----------------------------------------------------------------
lua_ls = {
root_markers = {
".luarc.json",
".luarc.jsonc",
".luacheckrc",
".stylua.toml",
"stylua.toml",
"selene.toml",
"selene.yml",
".git",
},
settings = {
Lua = {
workspace = { checkThirdParty = false },
completion = { callSnippet = "Replace" },
diagnostics = { globals = { "vim" } },
},
},
},
-- -----------------------------------------------------------------
-- TypeScript / JavaScript
-- -----------------------------------------------------------------
ts_ls = {
root_markers = { "tsconfig.json", "jsconfig.json", "package.json", ".git" },
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
},
-- -----------------------------------------------------------------
-- Web (HTML / CSS / JSON / YAML)
-- -----------------------------------------------------------------
html = {
root_markers = { "package.json", ".git" },
filetypes = { "html", "templ" },
},
cssls = {
root_markers = { "package.json", ".git" },
},
jsonls = {
root_markers = { "package.json", ".git" },
},
yamlls = {
root_markers = { "package.json", ".git" },
settings = {
yaml = {
keyOrdering = false,
schemas = {
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
["https://json.schemastore.org/docker-compose.json"] = "docker-compose*.yml",
},
},
},
},
-- -----------------------------------------------------------------
-- Markdown / SQL / Docker
-- -----------------------------------------------------------------
marksman = {
root_markers = { ".marksman.toml", ".git" },
},
sqlls = {
root_markers = { ".sqllsrc.json", "sqlls.json", ".git" },
},
dockerls = {},
docker_compose_language_server = {},
},
},
},
}

44
lua/plugins/mason.lua Normal file
View File

@@ -0,0 +1,44 @@
return {
-- Mason: manage LSP servers, linters, formatters
{
"mason-org/mason.nvim",
opts = {
ensure_installed = {
-- LSP servers
"gopls",
"lua-language-server",
"typescript-language-server",
"html-lsp",
"css-lsp",
"json-lsp",
"yaml-language-server",
"marksman",
"sqlls",
"pyright",
"ruff",
"docker-language-server",
"zls",
-- Linters
"golangci-lint",
"eslint_d",
"markdownlint",
"hadolint",
"shellcheck",
-- Formatters
"gofumpt",
"goimports",
"prettier",
"stylua",
"sql-formatter",
-- DAP adapters
"delve",
"js-debug-adapter",
"codelldb",
},
},
},
}

View File

@@ -1,14 +1,23 @@
-- Neotest: test runner with Go and Python adapters.
-- Loads on go/python filetypes, or when require("neotest") is called from a
-- keymap (config.keymap wraps the bindings in `function() require(...) end`
-- precisely so the lazy-load can happen.
return {
{
"nvim-neotest/neotest",
lazy = true,
ft = { "go", "ptyhon", "zig" },
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter", -- noetest-zig parses tests via treesitter
-- Adapters
"nvim-neotest/neotest-go",
"nvim-neotest/neotest-python",
"lawrence-laz/neotest-zig",
},
config = function()
require("neotest").setup({
@@ -32,6 +41,14 @@ return {
dap = { justMyCode = false },
args = { "--disable-warnings", "-q" },
}),
-- Zig: requires a standard `test` step in build.zig for project-wide runs;
-- individual .zig files also work.
-- dap.adapter must match the adapter named registered in dap.lua (codelldb) so <leader>dT-style
-- debug-test works from the summary too
require("neotest-zig")({
dap = { adapter = "codelldb" },
}),
},
})
end,

View File

@@ -1,8 +1,25 @@
-- Overseer: task runner.
-- Loads on demand when any Overseer command is invoked.
return {
{
"stevearc/overseer.nvim",
cmd = {
"OverseerOpen",
"OverseerClose",
"OverseerToggle",
"OverseerSaveBundle",
"OverseerLoadBundle",
"OverseerDeleteBundle",
"OverseerRunCmd",
"OverseerRun",
"OverseerInfo",
"OverseerBuild",
"OverseerQuickAction",
"OverseerTaskAction",
},
opts = {
templates = { "builtin", "user" }
templates = { "builtin", "user" },
},
},
}

View File

@@ -0,0 +1,69 @@
-- Treesitter parsers
-- LazyVim's nvim-treesitter spec uses opts_extend = { "ensure_installed" }
-- so this list is merged with the parsers added by language extras.
return {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
-- Go
"go",
"gomod",
"gowork",
"gosum",
-- Lua
"lua",
"luadoc",
-- Typescript / Javascript
"typescript",
"javascript",
"tsx",
-- Web
"html",
"css",
-- Data
"json",
"jsonc",
"yaml",
"toml",
-- Markdown / docs
"markdown",
"markdown_inline",
-- Zig
"zig",
-- Build / config
"ninja",
"sql",
"make",
-- Editor / shell
"vim",
"vimdoc",
"bash",
"regex",
-- Git
"diff",
"gitcommit",
"git_rebase",
-- Containers
"dockerfile",
-- Typesetting
"latex",
"typst",
},
highlight = { enable = true },
indent = { enable = true },
},
},
}

View File

@@ -1,5 +1,19 @@
-- Zig language support via the official Codeberg-hosted plugin.
-- Loads only on zig files.
--
-- The rest of the Zig toolchain is wired in alongside the other languages so
-- it benefits from the same lazy-loading and config:
-- * LSP (zls) ........... lspconfig.lua (servers.zls) + mason.lua
-- * Treesitter parser ... treesitter.lua ("zig")
-- * Tests in-buffer ..... neotest.lua (neotest-zig adapter, ft=zig)
-- * Debug (codelldb) .... dap.lua (dap.configurations.zig) + mason
-- * Run/build tasks ..... overseer/template/user/zig_{build,run,test}.lua
-- * Quick keymaps ....... keymaps.lua (<leader>cz*) + which-key group
return {
'https://codeberg.org/ziglang/zig.vim',
lazy = true,
ft = { "zig" },
{
"https://codeberg.org/ziglang/zig.vim",
lazy = true,
ft = { "zig" },
},
}