Search code examples
pythondebuggingvimvim-plugin

How can I interactively debug a python vim script?


I have a vim plugin that I'm writing in python, however I need to debug the python script. How can use pdb (or preferably ipdb) in the vim script itself? When I use pdb vim just hangs with no output, and when I use ipdb it turns vim into garbaged output.


Solution

  • You could try rpdb to debug remotely. Where the remote is just a different tab in your shell.

    Just install Winpdb (not windows specific anymore) http://winpdb.org/ It includes rpdb2 which is a remote version of pdb and winpdb itself is a nice graphical debugger.

    Usage example with Winpdb:

    import rpdb2
    rpdb2.start_embedded_debugger('some password')
    

    And from Winpdb:

    File -> Attach