When a vim plugin is developed in a mixed script of vim script and python, can we set breakpoints and debug the python script. I tried to use PDB module, but vim is dead when it go to the pdb.set_trace().

This post -- Writing Vim plugin in Python -- says "You can test and debug it outside Vim with whatever tools you typically use." But when the python script import vim, it cannot run outside Vim.

Note: I'm not asking how I can debug python code in vim like a python IDE. When I google for my question, all I got is to answer this different question. :(

1 Answer 1


I find a way myself -- a python module rpdb - remote debugger based on pdb.

It works for me.

  1. Install using pip install rpdb
  2. Set breakpoint with rpdb.set_trace() in plugin python script.
  3. Try to active the plugin in vim. The vim will hang-up.
  4. Use telnet to connect the vim process. telnet localhost 4444. It will be same as pdb to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.