In vim 8, is it possible to insert visually blank regions into a window without modifying the underlying buffer?
I am writing a plugin (my first!) to assist me in updating patch files. The idea is very similar to a three-way-diff but with a patch file in the center region. The idea is to be able to modify the patch hunks to apply to files which have changed, usually due to updating an underlying BSP in Yocto. As the patches are edited I plan to update things like the hunk offsets + context and to use highlights to display breakages when applying the patch.
To make this process visually intuitive, I intend to have all three buffers "joined" so that scrolling one scrolls all. This is similar to many diff tools. Now, since there will be different (but related) content in each of the buffers, I want to visually "pad" each to the same final length. To do this, I could just add regular line breaks.
The rub here is that I then want to be able to write the file to disk without these newlines. Worse, I can't blindly strip whitespace as it may be used for context in some of the hunks.
I have considered adding sentinel lines in the buffer and rendering them as blanks and stripping them on write but I am not sure how this would be achieved. In addition, Vim has diff mode so I would expect this to be a somewhat solved problem.