5

I'm using vim for python scripting and currently approaching jedi-vim for autocomplete, navigation and refactoring. But it would be nice to have some ide-like debugging facilities.

Is there some plugin available?

1

3 Answers 3

4

I have successfully used vdebug for php and python, it provides the UI inside vim to visually step through the code, see stack traces, evaluate expressions, etc. But unfortunately, it's quite complex to setup (at least was when I was using it) - it requires the DBGP server and komodo's server worked for me. I also have helper snippets in my vimrc to automatically start the server and then start the debugger.

But recently I am only working with python and switched to the combination of ipdb / pdbpp console debuggers and I am quite happy with the experience. I use ipdb as primary debugger and pdbpp provides additional "sticky" (full-screen) mode.

You just need to pip install ipdb and pip install pdbpp and then put a breakpoint (__import__('ipdb').set_trace()) into your python module.

Once the script or web app stops at the breakpoint, I immediately enter sticky to switch to the full-screen mode and then use n / s and other pdb commands to steps through the code, inspect variables, etc.

2

Try the python-mode plugin. Its the closest thing to a python ide coupled to VIM. However, as far as I know python-mode and jedi-vim are not compatible.

If you need to add more power on top, like youcompleteme or syntastic, you have to build the collection yourself. I just combined a number of plugins: python-mode, syntastic, awesome-vim, youcompleteme. There's a lot of conflicts, and some of them dont work well with each other.

2
  • Does python-mode support debugging? It's not mentioned in the README
    – Rich
    Oct 27, 2017 at 16:22
  • python-mode is very configurable. If you disable rope and its linters, for example, you can use other linters (Syntastic, ALE), and completion plugins (YCM, deoplete). They all work well together if you disable the conflicting bits. The main problem is that python-mode tries to do everything. Oct 27, 2017 at 17:22
0

If you only want a debugger, I use the pudb module that provides a "graphical" interface (in the terminal, but with syntax highlight, windows...).

I launch it with :term python -m pudb %, and it works very well for me.

NOTE: pudb has all the features of pdb, it only adds a graphical and convenient layer. even the shortcuts are the same.

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.