updated zig toolset to allow for build, run, debug and test #1

Merged
sam_oneal merged 1 commits from zig_update into main 2026-06-06 21:58:28 +00:00
13 changed files with 451 additions and 141 deletions

View File

@@ -90,6 +90,10 @@
{ {
"path": "detect_secrets.filters.allowlist.is_line_allowlisted" "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", "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2 "min_level": 2
@@ -133,19 +137,12 @@
} }
], ],
"README.md": [ "README.md": [
{
"type": "Secret Keyword",
"filename": "README.md",
"hashed_secret": "6d9c68c603e465077bdd49c62347fe54717f83a3",
"is_verified": false,
"line_number": 55
},
{ {
"type": "Basic Auth Credentials", "type": "Basic Auth Credentials",
"filename": "README.md", "filename": "README.md",
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684", "hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
"is_verified": false, "is_verified": false,
"line_number": 68 "line_number": 85
} }
], ],
"lazy-lock.json": [ "lazy-lock.json": [
@@ -585,5 +582,5 @@
} }
] ]
}, },
"generated_at": "2026-05-09T17:04:51Z" "generated_at": "2026-06-06T21:52:58Z"
} }

372
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 ## Prerequisites
- Neovim >= 0.9.0 (installed via Homebrew) - **Neovim >= 0.11** (developed on 0.12.x; 0.11+ is required for the modern
- Git `vim.lsp` / `root_markers` API used by some servers)
- A Nerd Font (for icons) - **Git**
- Node.js (for some LSP servers and formatters) - **A Nerd Font** (icons in the explorer, statusline, dadbod UI, etc.)
- Go (for gopls and delve) - **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 ## Installation
1. **Backup existing configuration** (if any): 1. **Back up any existing config:**
```bash ```bash
mv ~/.config/nvim ~/.config/nvim.bak mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/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 mv ~/.cache/nvim ~/.cache/nvim.bak
``` ```
2. **Clone this configuration**: 2. **Clone:**
```bash ```bash
git clone <your-repo-url> ~/.config/nvim git clone https://git.samoneal.io/sam_oneal/nvim-config.git ~/.config/nvim
``` ```
3. **Start Neovim**: 3. **Launch Neovim.** lazy.nvim bootstraps itself and installs all plugins.
```bash
nvim
```
Lazy.nvim will automatically install all plugins on first launch.
4. **Install LSP servers and tools**: 4. **Install tooling** with `:Mason` (or `:MasonInstall <tool>`). Check health
After plugins load, run: with `:checkhealth` and LSP attachment with `:checkhealth lsp`.
```
:Mason
```
All required tools should install automatically.
## Features ## What's included
### Language Support (LSP + Treesitter) **Base:** [LazyVim](https://www.lazyvim.org/) with leader = `<Space>`,
- Go, Lua, TypeScript, JavaScript, HTML, CSS, JSON, YAML, Markdown, SQL, Makefile localleader = `\`, colorscheme `catppuccin-mocha`.
### AI Chat Integration **LazyVim extras enabled** (in `lua/config/lazy.lua`): `lang.go`, `lang.json`,
Supports multiple providers via [avante.nvim](https://github.com/yetone/avante.nvim): `lang.yaml`, `lang.markdown`, `lang.typescript`, `lang.tailwind`,
- Anthropic Claude `dap.core`.
- OpenAI GPT
- Google Gemini
- And more
Set your API keys as environment variables: **Languages (LSP + Treesitter):** Go, Zig, Lua, TypeScript/JavaScript, HTML,
```bash CSS, JSON, YAML, Markdown, SQL, Dockerfile, Python.
export ANTHROPIC_API_KEY="your-key"
export OPENAI_API_KEY="your-key"
export GEMINI_API_KEY="your-key"
```
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) ### AI (opencode.nvim)
- `:DBUIToggle` - Open database UI
- `:DBUIAddConnection` - Add a new connection 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 postgresql://user:pass@localhost:5432/dbname
mysql://user:pass@localhost:3306/dbname mysql://user:pass@localhost:3306/dbname
sqlite:path/to/db.sqlite sqlite:path/to/db.sqlite
``` ```
### Go Debugging (DAP + Delve) SQL completion is provided via dadbod inside SQL buffers, and SQL
Full debugging support with breakpoints, stepping, variable inspection. 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 | | Key | Action |
|-----|--------| |-----|--------|
| `<leader>th` | Open terminal (horizontal split) | | `<leader>tt` | Run nearest test |
| `<leader>tv` | Open terminal (vertical split) | | `<leader>tf` | Run test file |
| `<C-\>` | Toggle floating terminal | | `<leader>ts` | Toggle test summary |
| `<Esc><Esc>` | Exit terminal mode | | `<leader>to` | Open test output |
| `<leader>tc` | Show coverage (Go) |
### File Explorer (Snacks explorer) ### Debugging (DAP, `<leader>d`)
| 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) |
### AI Chat Go uses delve; Zig/C/C++ use codelldb. Zig launch configs build with debug
| Key | Action | symbols first, then run (`Launch (zig build)` prompts for the exe under
|-----|--------| `zig-out/bin`; `Launch (current file)` compiles the open file).
| `<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
| Key | Action | | Key | Action |
|-----|--------| |-----|--------|
| `<leader>db` | Toggle breakpoint | | `<leader>db` | Toggle breakpoint |
| `<leader>dB` | Breakpoint with condition | | `<leader>dB` | Conditional breakpoint |
| `<leader>dc` | Continue | | `<leader>dc` | Continue / start |
| `<leader>dC` | Run to cursor |
| `<leader>di` | Step into | | `<leader>di` | Step into |
| `<leader>do` | Step out |
| `<leader>dO` | Step over | | `<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>du` | Toggle DAP UI |
| `<leader>de` | Eval (n/v) |
| `<leader>dT` | Debug Go test | | `<leader>dT` | Debug Go test |
| `<leader>dt` | Terminate debug session | | `<leader>dL` | Debug last Go test |
### Formatting ### Tasks (Overseer, `<leader>o`)
| Key | Action |
|-----|--------|
| `<leader>cf` | Format buffer |
| `:FormatToggle` | Toggle auto-format on save |
| `:FormatDisable` | Disable auto-format |
| `:FormatEnable` | Enable auto-format |
### General
| Key | Action | | Key | Action |
|-----|--------| | ------------ | --------------------------------------------------------- |
| `<C-s>` | Save file | | `<leader>or` | Run a task (picker — includes `go:` and `zig:` templates) |
| `<S-h>` / `<S-l>` | Previous/Next buffer | | `<leader>ot` | Toggle task list |
### 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-h/j/k/l>` | Navigate windows |
| `<A-j>` / `<A-k>` | Move line down/up | | `<C-Up/Down/Left/Right>` | Resize window |
## File Structure ### 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/ ~/.config/nvim/
├── init.lua # Entry point ├── init.lua # Entry point → require("config.lazy")
├── lua/ ├── lua/
│ ├── config/ │ ├── config/
│ │ ├── lazy.lua # Lazy.nvim bootstrap & LazyVim setup │ │ ├── lazy.lua # lazy.nvim bootstrap, LazyVim + extras
│ │ ├── options.lua # General Neovim options │ │ ├── options.lua # Neovim options
│ │ ├── keymaps.lua # Custom key bindings │ │ ├── keymaps.lua # Custom keymaps
│ │ └── autocmds.lua # Auto commands │ │ └── autocmds.lua # Autocommands (yank hl, ft tweaks, SQL no-autoformat…)
── plugins/ ── plugins/
├── lsp.lua # LSP & Treesitter configuration ├── mason.lua # Tooling installs (LSP/linters/formatters/DAP)
├── ai.lua # AI chat integration (avante.nvim) ├── lspconfig.lua # Per-server LSP config (gopls, zls, …)
├── dadbod.lua # Database integration ├── treesitter.lua # Parsers
├── dap.lua # Debugging configuration ├── formatting.lua # conform.nvim
├── formatting.lua # Auto-formatting (conform.nvim) ├── dap.lua # Debugging (Go via delve, Zig via codelldb)
── editor.lua # Editor enhancements (snacks explorer, etc.) ── 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 | - LSP is `zls` (`lua/plugins/lspconfig.lua`), root markers `build.zig` /
|-----------|-----------| `build.zig.zon`, with build-on-save and inlay hints.
| Go | gofumpt, goimports | - `zig build test` and project-wide neotest runs require a standard `test` step
| Lua | stylua | in your `build.zig`; individual `.zig` files also work.
| JS/TS/JSX/TSX | prettier | - Debugging needs `codelldb` (`:MasonInstall codelldb` if it doesn't
| HTML/CSS | prettier | auto-install). Builds use `-O Debug` so symbols are present.
| JSON/YAML | prettier |
| Markdown | prettier |
| SQL | sql-formatter |
## Troubleshooting ## Troubleshooting
### LSP not working - **LSP not attaching:** `:checkhealth lsp` — confirm the server appears and is
Run `:LspInfo` to check status. Run `:Mason` to verify tools are installed. 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 ## Known issues (in current repo)
Run `:ConformInfo` to check formatter status.
### Icons not displaying Two unrelated typos exist in `lua/config/keymaps.lua`'s opencode block (present
Install a Nerd Font and configure your terminal to use it. 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
### Ctrl+Shift keybindings not working `n`/`x` is likely intended. Documented here for accuracy; fix when convenient.
Some terminals don't properly send Ctrl+Shift combinations. Use the alternative mappings (`<C-v>` and `<C-x>` in snacks explorer).

View File

@@ -128,6 +128,16 @@ map("n", "<leader>cgpt", function()
vim.cmd("!go test -run=^$ -bench=. -trace trace.out ./...") vim.cmd("!go test -run=^$ -bench=. -trace trace.out ./...")
end, { desc = "Go trace profile" }) end, { desc = "Go trace profile" })
-- ─────────────────────────────────────────────────────────────────────────────
-- 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" })
-- ───────────────────────────────────────────────────────────────────────────── -- ─────────────────────────────────────────────────────────────────────────────
-- Overseer -- Overseer
-- ───────────────────────────────────────────────────────────────────────────── -- ─────────────────────────────────────────────────────────────────────────────

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

@@ -167,6 +167,68 @@ return {
}, },
}, },
-- -------------------------------------------------------------------------
-- 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) -- DAP UI keymaps + auto open/close (the spec itself is loaded as a dep above)
-- ───────────────────────────────────────────────────────────────────────── -- ─────────────────────────────────────────────────────────────────────────
@@ -239,7 +301,7 @@ return {
{ {
"jay-babu/mason-nvim-dap.nvim", "jay-babu/mason-nvim-dap.nvim",
opts = { opts = {
ensure_installed = { "python", "delve", "js" }, ensure_installed = { "python", "delve", "js", "codelldb" },
}, },
}, },

View File

@@ -77,6 +77,7 @@ return {
{ "<leader>c", group = "Code" }, { "<leader>c", group = "Code" },
{ "<leader>cg", group = "Go" }, { "<leader>cg", group = "Go" },
{ "<leader>cgp", group = "Profile" }, { "<leader>cgp", group = "Profile" },
{ "<leader>cz", group = "Zig" },
{ "<leader>d", group = "Debug" }, { "<leader>d", group = "Debug" },
{ "<leader>D", group = "Database" }, { "<leader>D", group = "Database" },
{ "<leader>f", group = "Find" }, { "<leader>f", group = "Find" },

View File

@@ -11,9 +11,9 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
-- Go -- Go
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
gopls = { gopls = {
root_markers = { "go.work", "go.mod", ".git" }, root_markers = { "go.work", "go.mod", ".git" },
settings = { settings = {
@@ -60,9 +60,29 @@ return {
}, },
}, },
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
-- 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
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
lua_ls = { lua_ls = {
root_markers = { root_markers = {
".luarc.json", ".luarc.json",
@@ -83,9 +103,9 @@ return {
}, },
}, },
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
-- TypeScript / JavaScript -- TypeScript / JavaScript
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
ts_ls = { ts_ls = {
root_markers = { "tsconfig.json", "jsconfig.json", "package.json", ".git" }, root_markers = { "tsconfig.json", "jsconfig.json", "package.json", ".git" },
settings = { settings = {
@@ -114,9 +134,9 @@ return {
}, },
}, },
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
-- Web (HTML / CSS / JSON / YAML) -- Web (HTML / CSS / JSON / YAML)
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
html = { html = {
root_markers = { "package.json", ".git" }, root_markers = { "package.json", ".git" },
filetypes = { "html", "templ" }, filetypes = { "html", "templ" },
@@ -143,9 +163,9 @@ return {
}, },
}, },
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
-- Markdown / SQL / Docker -- Markdown / SQL / Docker
-- ───────────────────────────────────────────────────────────────── -- -----------------------------------------------------------------
marksman = { marksman = {
root_markers = { ".marksman.toml", ".git" }, root_markers = { ".marksman.toml", ".git" },
}, },

View File

@@ -37,6 +37,7 @@ return {
-- DAP adapters -- DAP adapters
"delve", "delve",
"js-debug-adapter", "js-debug-adapter",
"codelldb",
}, },
}, },
}, },

View File

@@ -7,15 +7,17 @@ return {
{ {
"nvim-neotest/neotest", "nvim-neotest/neotest",
lazy = true, lazy = true,
ft = { "go", "ptyhon" }, ft = { "go", "ptyhon", "zig" },
dependencies = { dependencies = {
"nvim-neotest/nvim-nio", "nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim", "antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter", -- noetest-zig parses tests via treesitter
-- Adapters -- Adapters
"nvim-neotest/neotest-go", "nvim-neotest/neotest-go",
"nvim-neotest/neotest-python", "nvim-neotest/neotest-python",
"lawrence-laz/neotest-zig",
}, },
config = function() config = function()
require("neotest").setup({ require("neotest").setup({
@@ -39,6 +41,14 @@ return {
dap = { justMyCode = false }, dap = { justMyCode = false },
args = { "--disable-warnings", "-q" }, 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, end,

View File

@@ -36,6 +36,9 @@ return {
"markdown", "markdown",
"markdown_inline", "markdown_inline",
-- Zig
"zig",
-- Build / config -- Build / config
"ninja", "ninja",
"sql", "sql",

View File

@@ -1,5 +1,14 @@
-- Zig language support via the official Codeberg-hosted plugin. -- Zig language support via the official Codeberg-hosted plugin.
-- Loads only on zig files. -- 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 { return {
{ {