Sunday, October 26, 2014

Re: how to join all lines in a paragraph?

On 2014-10-26 11:12, Josh Hoff wrote:
> >>> I have been trying to find in google how to join all lines in a
> >>> given paragraph, or a range to lines.
> >>
> >> You could use visual mode: vipJ
> >
> >That was so simple I now feel embarrassed.
> >Thanks a lot!
>
> Cheers :). I bet there's a sneaky way to do it if you want a :
> command (maybe something using :normal?). That way you could get a
> range/selection/mark going.

You can use the :j command to join a range of lines which works
nicely with the range "'{,'}" or with a :g command such that you
could do things like

:g/^\n\</+;'}-j

which will join every line-separated paragraph(*) in your entire
document into single-line paragraphs.

-tim

(*) it expects a blank line before it so it might miss the first
paragraph in your document if there's not a blank line in before it.




--
--
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/d/optout.

No comments:

Post a Comment