Tuesday, January 17, 2017

Re: Having certain lines readonly

On Monday, January 16, 2017 at 12:06:05 PM UTC-6, Tihomir Mitkov wrote:
> неделя, 15 януари 2017 г., 16:10:42 UTC+2, lith написа:
> > > Thank for your post. I figured out that I can simulate readonly lines by keeping metadata about lines and remapping all keys to a function which decides upon that metadata whether to put the character in question.
> >
> > An alternative approach would be to use the CursorMoved(I) events to toggle the readonly option depending on which line the cursor is located at.
> >
> > E.g. the setsyntax plugin (http://www.vim.org/scripts/script.php?script_id=2076) can be used to achieve something like this based on the syntax group under the cursor.
> >
> > Regards
>
> CursorMoved(I) would be much more robust. Thanks for your advice.

I think you're still going to have trouble with commands which can modify multiple lines. What will you do to handle global search-and-replace via ":%s/pat/rep/g"? Or multiple-line delete with either "10dd" or ":123,456d"? There are too many ways to modify lines to protect a specific range of lines from all edits, which is what I'd expect from a "read only lines" feature.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment