Is it possible to highlight specific and arbitrary rectangles in a buffer? I want to implement a code scope highlight that groups code into a hierarchy of boxes. here is my mockup that I made:

enter image description here

assuming that the coordinates of the boxes are computed for the buffer contents using a standalone script (to liberate it from any dependency on the syntax system and language semantics), I wonder how practical it could be to render the background colors inside vim to an arbitrary degree (many areas going beyond the end of lines need to be painted).

  • while you can highlight lines, it is impossible to highlight arbitrary rectangular regions, unless the width is smaller than the smallest line it covers. – Christian Brabandt May 11 '18 at 17:59
  • That's what i feared @ChristianBrabandt :( – Steven Lu May 11 '18 at 18:09
  • On a side note, I think using folding would be much easier to read and much more comfortable than this kind of highlighting :h folding – statox May 15 '18 at 9:31
  • I would rather scroll farther than to make content invisible. But yes I have looked at folding before. – Steven Lu May 15 '18 at 16:54

Your Answer

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

Browse other questions tagged or ask your own question.