Course Lessons
What is DAP?
The debug adapter protocol has a very similar story to the language server protocol. It was developed by, you guessed it, Microsoft. And it was developed for... you guessed it.... VSCode.
DAP allows for a communication between editors and debuggers through a middleman called a Debug Adapter. Using Debug Adapters, A package called nvim-dap
, and a debugger, we can achieve a wonderful debugging environment for Neovim.
Here's a brief overview of how DAP in Neovim works:
- DAP Client Integration: Neovim, with plugins like
nvim-dap
, acts as a DAP client. These plugins handle the integration and provide an interface within Neovim for debugging. - Debug Adapter: A debug adapter is a separate program that translates the DAP messages between Neovim and the debugger for the specific programming language.
- Communication: Neovim sends DAP requests (like starting a debug session, setting breakpoints, or stepping through code) to the debug adapter over a communication channel (e.g., TCP or STDIO).
- Execution and Response: The debug adapter processes these requests, communicates with the actual debugger, and sends back responses (like current variable values, execution status, or error messages).
- User Interface: The plugin presents this information in Neovim, allowing users to control and observe the debugging process directly within the editor.
By leveraging DAP, Neovim can support a wide range of debugging tools and languages, enhancing its capabilities as a development environment.
Here is a flowchart of how DAP works with Neovim.

To get a debugging experience in our Neovim setup, we're going to want to install nvim-dap
: https://github.com/mfussenegger/nvim-dap.
Lets create a new file in our configuration called debugging.lua
(or name it however you want). in this file, we can return a simple lua table that looks like this:
return {
"mfussenegger/nvim-dap"
}
next, we want to copy over some helpful keybindings from the API of nvim-dap
in order to, you know, toggle breakpoints and whatnot. Here is the config after adding keybindings:
config = function()
require("dapui").setup()
vim.keymap.set("n", "<Leader>dt", ":DapToggleBreakpoint<CR>")
vim.keymap.set("n", "<Leader>dc", ":DapContinue<CR>")
vim.keymap.set("n", "<Leader>dx", ":DapTerminate<CR>")
vim.keymap.set("n", "<Leader>do", ":DapStepOver<CR>")
end
Now quit and re-open neovim and it should install nvim-dap
!
You've completed this lesson!
You completed this lesson less than a minute ago.