← Back to Upcase

Debugging Vim

(Luís Ferreira) #1

I want to do some work on a vim plugin, but I find it hard to debug it to find out what’s going on. All the documentation I’ve points echo or similar. Is there no better way?

Also, what’s the best way of loading a plugin for this purpose? Through vundle?

@benorenstein @jferris @christoomey

(Scott) #2

Yes, debug printfs are often the best debugging technique for any language. What more do you want for your vim development? The ability to single step?

A repl would be nice, of course. Vim has one but, like vim, it’s pretty eclectic.

Vundle does some interesting things with load paths… I find plain pathogen great for developemnt. Just git push from your .vim/bundle/repo.

(Luís Ferreira) #3

I use vundle for all plugins, not pathogen, I tend to prefer it.

I would like to stop on a breakpoint and inspect the variables, yes. But even echo and echom don’t work very well for me, since you have to check the messages. Is there a better way of doing this?

(Scott) #4

Vundle should work too, it just does a little more magic under the covers.

Have you seen :help debug-scripts? I’ve never used it but it does seem to allow breakpoints.

I agree, the messages are an easily-overlooked wasteland… but I don’t know of anything better. If you find something, I hope you’ll blog about it or report back!

(Luís Ferreira) #5

I have looked at that, and I think I was able to add a breakpoint, but the execution does not stop there. I’m not sure I’m doing it right and there are very few examples I could find online.

Also, I cannot echo non strings variables, such as lists, I can only do it with echo join(list, '').

(Aaron Mc Adam) #6

Have you tried https://github.com/elentok/vimspec or https://github.com/tpope/vim-scriptease

(Luís Ferreira) #7

Testing is not the problem I’m trying to solve. Scriptease seems cool, though. Thanks.