I'm interested in different ways to debug/trace or/and see the execution in real time (a la bash -x) vimscript.


In an extremely related Q/A, I've listed all the tools I provide and use to help tracking errors in vim scripts: https://vi.stackexchange.com/a/25863/626

They come in complement of :debug.

  • Very nice! One question though: you mentioned on your post that :debug isn't perfect, and would be better if Vim was multi-threaded...but doesn't Vim have async support now? Can :debug profit from it? Sep 10 '20 at 9:01
  • 2
    Unfortunately no. I don't know the specifics. Somehow, Vim async implementation is equivalent to processes in the background with asynchronous communication. Vim kernel isn't multithreaded. I don't know whether it's done with polling or interruptions when something is received. What I observe is that when a message is received, normal processing is interrupted the time the message is being handled, then resumed. Sep 10 '20 at 9:21
  • Gotcha! That's very informative. Hopefully we'll see a real hyper-threaded support in the near future. Sep 10 '20 at 9:23
  • 1
    That's unlikely :( Sep 10 '20 at 9:26
  • UI thread is necessarily single threaded anyway, and the majority of Vim plugins and functions are constantly working on the UI, either capturing input or changing the screen. Multithreading UI makes writing code and plugins much harder to get right, and is not going to be faster since you'll have to take lots of fine grained locks, which will actually slow things down. The only thing you can multithread are generally computationally heavy tasks that doesn't involve much UI interaction and for those, you can just use message passing, aka async communications to a separate process just fine.
    – Lie Ryan
    Sep 12 '20 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.