On Sat, Apr 29, 2000, Adam Shand wrote:
> 
> > A two-liner is
> > %s/^/<p>/   - add <p> to the start of each line
> > %s/^<p>$//  - remove any lines that contain only <p>
> 
> nope won't work.  it'll put a '<p> ' at the beginning of every line which
> has text in it.  thus this:

Ah.  Don't know how to do that with regex's but you can get it
done with record/playback with Vim and Elvis.  You probably
already know this.

qa - start recording to register a
/^$  - go to first blank line
<cursor down>
<i>nsert and type <P>
<esc>
q  - stop recording

[EMAIL PROTECTED]  - repeats the recorded keystrokes a bunch of times

If you have multiple adjacent blank lines you'll need to
squash them to one,
:g/^$/,/./-j

Gotta be an easier way though.  Maybe one of the vi pros will drop in.

Rick
-- 

Reply via email to