Saturday, April 6, 2013

Re: Line break without \n or \r?

On Apr 6, 2:10 pm, zappathus...@free.Fr wrote:
> Now I understand, and it's actually quite simple.
> The pattern
>     \([^\\n]\)\n\([^\\n]\)
> ...
> and you ended up with
>     uuuu An
>     by y
> because the "n" at the end of the first line was excluded
> from the pattern.

Can be simplified to:

:%s/\n\([^\n]\)/ \1/

Finds a linefeed followed by a non-linefeed
and replaces the linefeed with a space.

Changes this:
=============

uuuu
An
by
y

uuuu
An
by
y

To this:
========

uuuu An by y
uuuu An by y

Then if needed, a second search/replace to
separate 'paragraphs' by at most one blank line:

:%s/\n\+/\r\r/

To this:
========

uuuu An by y

uuuu An by y

Bill

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment