Re: multi line regex's in vi ...
that's useful, thanks. i've never used macro's in vi, i'll play with it. i
need to check out wml as well as someone else suggested ;)
adam.
On Sat, 29 Apr 2000, Rick Younie wrote:
> 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
>
> 999@a - 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
> --
>
>
> --
> Unsubscribe? mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
>
Reply to: