Wednesday, July 18, 2012

Re: How to remove empty lines except of one

On Wed, Jul 18, 2012 at 10:27:02PM EDT, Ben Fritz wrote:
> On Wednesday, July 18, 2012 3:35:56 PM UTC-5, Bee wrote:

[..]

> > >
> > > Note this is almost identical to my first proposed solution, except that it is missing the beginning of line anchor. I'm not sure what makes it fail with the ^ in place.
> >
> > osx terminal vim 7.3.584
> >
> > %s-\_s\+\n-\r
> >
> > Removes ALL blank lines,
> > rather than collapsing multiple blank lines into one 'blank' line.
> >
> > I still want one blank line between 'paragraphs'.

> Oh right...that's why the ^ was there in the first place. Now
> I remember :-)

I started pretty much along the same lines, using the '^' anchor, but
since I was seeing funny results at the end of buffer, I decided to take
the heavy-handed approach: 1 Vim buffer = one long string.

Not that it helped much.. :-(

What bugs me is that I'm still unsure whether my regex is buggy or Vim..
or.. ?? :-)

> So, it's still a special case if the first or last line is blank.
> Instead of removing all blank lines, it leaves one blank line in its
> place at the beginning and end.

As an aside, probably due to the mailer you are using, _some_ of your
posts end up with html '>' quoted text signs beyond the first one
(when viewed in mutt, Vim, the 'less' pager, etc.) -- see above..

Not sure what's causing this.

CJ

--
Oh My God!!! Larry is back!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment