Setting up the Debug Adapter Protocol (DAP) in Neovim transforms C and C++ workflows by integrating full-featured debugging—breakpoints, call stacks, REPL execution, and variable evaluation—directly into your modal editing experience.
Rather than maintaining static code snippets in this post, you can inspect my active setup directly on GitHub:
👉 VincentTam/nvim-config: lua/plugins/dap.lua
Core Architecture
The setup relies on three primary components managed through
lazy.nvim:
mfussenegger/nvim-dap: The foundational DAP client implementing protocol communication with native debuggers.rcarriga/nvim-dap-ui: Provides layout management, split frames, and floating windows for scopes, stacks, and watches.williamboman/mason.nvim: Handles system binaries and language tool installation.
Ergonomic Navigation: Shift + Arrow Shortcuts
While traditional DAP keymaps often use multi-key leader sequences (e.g.,
<Leader>dn), navigating execution during a active step-by-step session is much
faster with single-key modifications.