thank you for your explanations ! :O)
Well, I'll see what I can do to help further...or create a
headache for you, as what follows is rather hackish. :)
With "protected" I mean the effect of doing as follows (but I mean
the result only ... not the way which leads to it...)
There is a text with some lines containing the word "gold".
Those lines should never be changed/edited.
Therefore I will do a :g/gold/d
Then I will do all commands, mistakes or whatever, which I will
do -- all "gold" lines will not be affected.
After all that I will do a "undo delete of all lines containing
'gold'" -- and that's it.
To do something like what you describe, you'd have to maintain a
list of "protected" lines. Something like
:let b:plines = ','
:map <f4> :let b:plines = b:plines.line('.').','<cr>
:map <f5> :let b:plines = substitute(b:plines,
','.line('.').',', ',', 'g')<cr>
This will set up a local variable called b:plines that will track
which lines are protected. You can then protect lines by hitting
<f4> on the line in question. You can unprotect lines using
<f5>. You can simply clear all marks by setting b:plines back to
','.
With a little more trickery, one could get a single key to toggle
the protected state of the line. I don't know how to show that a
given line is "protected", but I know there's a "signs" feature
in vim that will put icons in the margin. Something might be
doable like that.
Then, you can do things like
:g/gold/if b:plines !~ ','.line('.').',' | d | endif
which will "d" (or any group of ex commands you want) any lines
that match /gold/, but won't operate on any such lines that are
protected.
It's a bit unwieldy, but for common actions, one could create
some mappings or user-defined commands...
Hope my german English is english enough... ;)
Far better than any German I'd try and fire back your way.
-tim