Often from the first part of a program lines are copied to the down, newer part of the program. On the new location they are to be altered by editing.

Unintentionally it happens that the lines on the original location are changed.

How can I lock and make readonly the upper part of the file?

  • 1
    AFAIK there is no way to set buffer partially read-only. First problem is how is Vim to know where "upper part" of a file starts and ends. Guess one could add an autocmd on InsertEnter or the like and check line-number and issue a warning. Line number could for example be marked by a special comment text. Or one could perhaps give it some other syntax highlighting for normal text.
    – ibuprofen
    May 20, 2021 at 10:53


You must log in to answer this question.

Browse other questions tagged .