On 29.12.19 17:43, Efraim Yawitz wrote:
> I wonder if this could be easily hacked into the code of vim by creating a
> new syntax group called Unchangeable or something and adding code to make
> it uneditable.
Or more easily in the folding code? That already treats an arbitrary
number of lines as a single unit when a fold is closed. To make a fold
immutable, its fold status would admittedly need to be checked by all
edit operations - when the fold is open - a condition when it is hardly
distinguishable from any other text.
If done there, the immutable text would inherently still be able to be
moved, like any other closed fold, without needing to toggle the
immutability tag on the fold, I figure.
The various existing foldmethods would seem well suited to delimiting
protected text. But how to add the protecting metadata in anything other
than an easily circumvented way is difficult to imagine.
Erik