Web lists-archives.com

Re: text editors

mick crane <mick.crane@xxxxxxxxx> writes:

> Is there any text editor, preferably in a terminal that has the
> facility to protect lines in the document, not the document itself ?

If by “protect” you mean “prevent editing these lines but not others”,
no I think that's not a feature of any editor I know.

You can achieve some protection by temporarily *hiding* lines you're not
wanting to edit.

Vim has “folding” (hiding a set of lines).

Emacs has “narrow&"9 to see nothing *but* a specific range of lines.

> I've got 2 blocks of "code" that look similar and I keep editing the
> wrong one and then it doesn't work.

I would use Emacs “narrow” commands for that; quickly narrow the focus
of the editor to only show me the area I'm meaning to edit, then easily
widen the range when I need to.

 \              “Ridicule is the only weapon which can be used against |
  `\       unintelligible propositions.” —Thomas Jefferson, 1816-07-30 |
_o__)                                                                  |
Ben Finney