Neovim debugging
Debug workflows: python local + docker attach, launch.json, C/C++, C#. Keybindings: see
nvim. Full guide:doc/nvim/README.md.
How it works
<leader>db sets a breakpoint, <leader>dc starts and shows a picker with
every config for the filetype — built-ins plus the project’s
.vscode/launch.json (read automatically). The debug UI opens with the
session and closes when it ends.
Adapters are mason-installed: debugpy (python), codelldb (C/C++), netcoredbg (C#).
Python: local
Venv is auto-detected (
$VIRTUAL_ENVor.venv/in project root); activate before launching nvim when in doubt.Run current file:
<leader>dc→ pickfile(orfile:argsfor arguments)Debug the pytest under cursor:
<leader>dm(method) /<leader>dM(class)
Python: docker attach
In the container, run the app under debugpy with the port published:
python -m debugpy --listen 0.0.0.0:5678 --wait-for-client app.py(docker run ... -p 5678:5678; –wait-for-client blocks until attach)Attach:
<leader>dc→Attach remote (docker/debugpy)Prompts with defaults: host127.0.0.1, port5678, container root/app.Container root = directory holding the code INSIDE the container. Wrong root → breakpoints show hollow and never hit (#1 failure).
Use
127.0.0.1, notlocalhost(can resolve to IPv6 and refuse).
Pin per-project: .vscode/launch.json
Picked up automatically by <leader>dc, no config needed:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach my-service",
"type": "debugpy",
"request": "attach",
"connect": { "host": "127.0.0.1", "port": 5678 },
"pathMappings": [
{ "localRoot": "${workspaceFolder}", "remoteRoot": "/app" }
],
"justMyCode": false
}
]
}
C / C++
- Build with debug info (
-g, or platformio debug build). <leader>dc→ codelldb config → enter path to the executable.
C#
dotnet build(Debug configuration).<leader>dc→ netcoredbg config → point atbin/Debug/<tfm>/<project>.dll.