Do you debug C++ code in Vim? How?

Andrew_Lvov picture Andrew_Lvov · Aug 21, 2010 · Viewed 81.4k times · Source

The question is to all you people, who use Vim to develop C++ applications.

There was a period in my life, which can be described as 'I hate Vim!!!'..'Vim is nice!'

However, having grown up mostly on Microsoft development IDEs, I've got used to those F5-F11 shortcuts when debugging code, watch window, call stack and the main code - all visible without need to type any GDB commands.

So, here is the question:

Do you use Vim as well for debugging? Or do you switch to some IDE for this purpose? Which one?

For those who use Vim to debug code: are there plugins to set breakpoints in editor, highlight the line we're currently debugging, auto-navigation during step, step into, step out?

Please, don't tell me you use GDB as command line, see only one line which is debugged, etc.

Answer

UncleZeiv picture UncleZeiv · Aug 22, 2010

In contrast with the other answers, there are at least three options that do just what you require: clewn, pyclewn and vimgdb.

All three projects are related. vimgdb is a patch against Vim and requires Vim to be recompiled. clewn is a standalone program that communicates with Vim through the Netbeans socket interface. This requires Vim to be built with the +netbeans option (this is the case in recent Linux distributions so it shouldn't be a problem).

To quote from the clewn's website:

Clewn implements full gdb support in the vim editor: breakpoints, watch variables, gdb command completion, assembly windows, etc.

I think you should definitely give it a go.

The homepage of the pyclewn website shows a comparison between the three projects.

A few months ago I tried pyclewn. It was a bit difficult to set up, but it looks well though out and promising. I just did some tests and you could set bookmarks, etc., the usual stuff you would expect from a graphical debugger. I ended up not using it for contingent reasons but I am keen to give it another try.