Monday, January 9, 2017

Re: Having certain lines readonly

On 02.01.17 03:42, Tihomir Mitkov wrote:
> Is it possible to have certain lines uneditable while keeping the rest of them editable?

In *nix, almost anything is possible. You could either excise the
protected lines with e.g. Awk, then reinsert them after exit from Vim
to the wrapper script, or leave them for whatever user benefit exists,
then overwrite them on exit, to defeat edits.

The protection zone could be primitively defined by line numbers, by
recognisable intrinsic content, or by arbitrary added delimiters.

If it were necessary to enforce reciprocal protection, i.e. those with
permission to edit the primary protected text should not touch the other
text (even if only to avoid finger fumbles), then the two halves could
perhaps be kept as identically named files in two adjacent directories,
with differing group ownership and limited write permissions, merged
only for consumption, not for editing.

In that case, Vim could be invoked on both files, perhaps in two tabs,
with the correct one automatically being read-only, as enforced by the
*nix permissions of the files, and the *nix group membership of the users.

Erik

--
Emacs is a nice OS - but it lacks a good text editor.
That's why I am using Vim. - Anonymous

--
--
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: