I have debug=msg,throw in my .vimrc.

When trying to debug a foldexpr function, the echom statements I use to print are ignored and are not accessible by :messages. Any way to make them work?

1 Answer 1


Sorry I don't have a clear answer to your problem, but a few tricks that you could use instead. Typically, you could add the messages into a |List| and display them (the list) on demand.

In my (complex) folding plugin for C&C++, I've used various techniques:

  • balloons to display various information when the mouse is over a line
  • signs to display in front of each line what the related call to foldexpr has returned
  • my logging framework that can report messages to the quickfix window (which is quite slow and best to not overuse each time foldexpr is evaluated)

Unfortunately, when there is an error, the only thing that permits to see the error is something like

:echo map(range(1, line('$')), 'the_fold_function(v:val)')

This last trick should also permit to display the messages you have produced.

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.