Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explore and debug vim script

Tags:

vim

debugging

I would like to dynamically debug a vim script. My current workflow is that I have the autoload plugin opened on a tmux pannel and the running application on the other pannel. I also set a tail -f vim.log and I launched vim with vim -V15vim.log. My goal is to monitor the execution of the plugin by adding plenty of echom.

Actually I was expecting something more useful that what I actually got.

  • I need to restart vim everytime I add a new echom
  • Nothing really useful is displayed on the log file vim.log
  • This method is obviously not the right one

I also tried to add breakpoints with breakadd func myfunc#test but it is not really working because the debugger windows interfers with the main window and change the way the plugin I am debuging behave.

How to improve my vim-script debug workflow?

HINT

I am actually trying to debug the vim-multiple-cursor plugin which does not work with a column block selection and virtualedit enabled. I would like to fix it.

like image 986
nowox Avatar asked Sep 05 '26 16:09

nowox


1 Answers

:breakadd is the most powerful tool, but yes, its output and interaction may interfere with certain plugin actions, and trigger additional autocmds. It may help if you specify the optional [lnum] offset to only stop executing inside the function.

I need to restart vim everytime I add a new echom

It should be enough if you just :source the changed plugin script again. Scripts inside ~/.vim/plugin/ usually employ a multiple inclusion guard that you need to work around, though. My ReloadScript plugin can help with that.

Alternatively, the Decho plugin might offer a different approach worth looking at.

like image 111
Ingo Karkat Avatar answered Sep 07 '26 09:09

Ingo Karkat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!