Back to rankings

mfussenegger/nvim-dap

Luacodeberg.org/mfussenegger/nvim-dap

Debug Adapter Protocol client implementation for Neovim

neovimneovim-plugindebug-adapter-protocoldebugger
Star Growth
Stars
7.2k
Forks
262
Weekly Growth
Issues
26
2k4k6k
Apr 2020May 2022Jun 2024Jul 2026
README

DAP (Debug Adapter Protocol)

nvim-dap is a Debug Adapter Protocol client implementation for Neovim. nvim-dap allows you to:

  • Launch an application to debug
  • Attach to running applications and debug them
  • Set breakpoints and step through code
  • Inspect the state of the application

demo

Installation

LuaRocks

  • Install nvim-dap like any other Neovim plugin:
    • git clone https://codeberg.org/mfussenegger/nvim-dap.git ~/.config/nvim/pack/plugins/start/nvim-dap
    • Or with vim-plug: Plug 'mfussenegger/nvim-dap'
    • Or with packer.nvim: use 'mfussenegger/nvim-dap'
  • Generate the documentation for nvim-dap using :helptags ALL or :helptags <PATH-TO-PLUGIN/doc/>

Supported Neovim versions:

  • Latest nightly
  • 0.12.x (Recommended)
  • 0.11.7

You'll need to install and configure a debug adapter per language. See

Usage

A typical debug flow consists of:

  • Setting breakpoints via :DapToggleBreakpoint or :lua require'dap'.toggle_breakpoint().
  • Launching debug sessions and resuming execution via :DapNew and :DapContinue or :lua require'dap'.continue().
  • Stepping through code via :DapStepOver, :DapStepInto or the corresponding functions :lua require'dap'.step_over() and :lua require'dap'.step_into().
  • Inspecting the state:
    • Via the built-in REPL: :lua require'dap'.repl.open()
      • Try typing an expression followed by ENTER to evaluate it.
      • Try commands like .help, .frames, .threads.
      • Variables with structure can be expanded and collapsed with ENTER on the corresponding line.
    • Via the widget UI (:help dap-widgets). Typically you'd inspect values, threads, stacktrace ad-hoc when needed instead of showing the information all the time, but you can also create sidebars for a permanent display
    • Via UI extensions:

See :help dap.txt, :help dap-mapping and :help dap-api.

Tip:

The arrow keys are good candidates for keymaps to step through code as their direction resembles the direction you'll step to.

  • Down: Step over
  • Right: Step into
  • Left: Step out
  • Up: Restart frame

You can setup keymaps temporary during a debug session using event listeners. See :help dap-listeners.

Supported languages

In theory all of the languages for which a debug adapter exists should be supported.

The Wiki is community maintained. If you got an adapter working that isn't listed yet, please extend the Wiki.

Some debug adapters have language specific extensions. Using them over a manual configuration is recommended, as they're usually better maintained.

If the instructions in the wiki for a debug adapter are not working, consider that debug adapters may have made changes since the instructions were written. You may want to read the release notes of the debug adapters or try with an older version. Please update the wiki if you discover outdated examples.

Goals

  • Have a basic debugger in Neovim.

  • Extensibility and double as a DAP client library. This allows other plugins to extend the debugging experience. Either by improving the UI or by making it easier to debug parts of an application.

    All known extensions are listed in the Wiki. The wiki is community maintained. Please add new extensions if you built one or if you discovered one that's not listed.

Non-Goals

  • Debug adapter installations are out of scope. It's not the business of an editor plugin to re-invent a package manager. Use your system package manager. Use Nix. Use Ansible.

  • nvim-dapconfig

  • Vim support. It's not going to happen. Use vimspector instead.

Alternatives

Contributing

Contributions are welcome:

  • Give concrete feedback about usability.
  • Triage issues. Many of the problems people encounter are debug adapter specific.
  • Improve upstream debug adapter documentation to make them more editor agnostic.
  • Improve the Wiki. But please refrain from turning it into comprehensive debug adapter documentation that should go upstream.
  • Write extensions.

Before making direct code contributions, please create a discussion or issue to clarify whether the change is in scope of the nvim-dap core.

Please keep pull requests focused and don't change multiple things at the same time.

Features

  • launch debug adapter
  • attach to debug adapter
  • toggle breakpoints
  • breakpoints with conditions
  • logpoints
  • set exception breakpoints
  • step over, step into, step out
  • step back, reverse continue
  • Goto
  • restart
  • stop
  • pause
  • evaluate expressions
  • REPL (incl. commands to show threads, frames and scopes)
Related repositories
neovim/neovim

Vim-fork focused on extensibility and usability

Vim ScriptOtherneovimc
neovim.io
101.3k7k
junegunn/fzf

:cherry_blossom: A command-line fuzzy finder

GoGo ModulesMIT Licensefzfgo
junegunn.github.io/fzf/
81.9k2.8k
sxyazi/yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.

Rustcrates.ioMIT Licenseasyncioconcurrency
yazi-rs.github.io
40.5k946
NvChad/NvChad

Blazing fast Neovim framework providing solid defaults and a beautiful UI, enhancing your neovim experience.

LuaGNU General Public License v3.0nvimneovim
nvchad.com
28.4k2.2k
LazyVim/LazyVim

Neovim config for the lazy

LuaApache License 2.0neovimneovim-conf
lazyvim.github.io
27k1.8k
folke/lazy.nvim

💤 A modern plugin manager for Neovim

LuaApache License 2.0neovimneovim-plugin
lazy.folke.io
21.3k585
rockerBOO/awesome-neovim

Collections of awesome neovim plugins.

ShellCreative Commons Zero v1.0 Universalnvim-luaneovim
21.2k1k
SpaceVim/SpaceVim

A modular configuration of Vim and Neovim

Vim Scriptneovimspacevim
spacevim.org
20.4k1.4k
wsdjeg/SpaceVim

A modular configuration of Vim and Neovim

Vim ScriptGNU General Public License v3.0neovimspacevim
spacevim.org
20.2k1.4k
nvim-telescope/telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.

LuaMIT Licenseneovimlua
19.6k956
LunarVim/LunarVim

🌙 LunarVim is an IDE layer for Neovim. Completely free and community driven.

LuaGNU General Public License v3.0neovimvim
lunarvim.org
19.3k1.5k
mhinz/vim-galore

:mortar_board: All things Vim!

Vim ScriptCreative Commons Attribution Share Alike 4.0 Internationalvimguide
17.9k631