Bindings to help with debugging

In my opinion, by far the worst thing about neovim at the moment is the difficulty in debugging issues with plugins.

I would like to get a few things setup to make this slightly less agonizing.

For one, there is a complicated key-binding which I am unsure how to make: I want to be able to call verbose for exactly the context I’m currently in. For example, I am having an issue with nvim-cmp right now where tab completion sometimes mysteriously stops working. I need to see what is setting the tab function, but if I do e.g. :verbose imap <tab> it gives me nothing, because the binding is only made when pumvisible.

So, are there any wizards around who can help me make a binding which reliably tells me information about another binding? For example, suppose I am typing some code, and without changing modes or anything like that, I want to type e.g. <C-a> [bound-key] where [bound-key] is the key I’m trying to figure out.


I don’t know if there’s a Lua equivalent yet, but Vimscript does have a built-in interactive debugger. See the :he debug-scripts docs section (oddly located in repeat.txt).

You might also get use out of the Scriptease plugin, which has some helper functionality for plugin development (but doesn’t solve the particular problem you stated): GitHub - tpope/vim-scriptease: scriptease.vim: A Vim plugin for Vim plugins.

1 Like

Doesn’t quite get me there, but seems useful, thanks.