Neovim for Beginners — Debugging using vimspector

Code debugging using the vimspector plugin.

3 min readFeb 27, 2022


Neovim for Beginners — Debugging using vimspector

Previously we talked about debugging using DAP. In this article, let’s try out vimspector. We use Python as the example but the steps are the same for other languages.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.


In the lua/plugins.lua file, add the lines to install the plugin.

Similar to other plugins, we lazy load vimspector when certain commands and functions are triggered. Check out the plugin management article for more details.


Create a new file lua/config/vimspector.lua with the following content.

  • In the debuggers function, we specify the debug adapters. Currently, we only configuredebugpy which is the debug adapter for Python. Check out the list of support languages to add adapters for those languages you want.
  • For vimspector to work, we need to create a project debug profile and the file name is called .vimspector.json. The generate_debug_profile function generates this file for the Python project.
  • We can also use custom snippets to generate the debug profile. I will talk about this in a later article.
  • The toggle_human_mode function turns on and off HUMAN mode, which uses the function keys for debugging.

Key Mappings

Let’s add several convenient key mappings to thelua/config/whichkey.lua file.




Software engineer, Data Science and ML practitioner.