Tim gave you the solution (:foldd). But I think there is
one small problem with operating on non-folded lines;
not with Tim's solution but with  folding in general.

Namely, you cannot fold single line.

I remembered this after I got back Meino's reply detailing what he wanted to do.

Fortunately, the :g command can take a more complex if|else|endif ex command as its action, so if the protected lines can be determined by a regexp, one could do something like

:g/gold/if getline('.') !~ 'exclusion regexp' | d | endif

where "d" is the delete action you want, and the "exclusion regexp" is a regexp that finds those lines on which you don't want to match "gold".

There's also a script/plugin (by Dr. Chip?) called something like "logipat" that allows for combining patterns with logical connectors that might also be helpful in such a scenario.

Just a bit more fodder for thought...

-tim





Reply via email to