On 16 Dec 2010, Tim Chase wrote: > On 12/16/2010 10:35 AM, Anthony Campbell wrote: > >On 16 Dec 2010, Tim Chase wrote: > >> :g/\%^\|\n\@<=\s*\n/,/\n\n\|\%$/j > > > >Thanks very much - that works perfectly. Now I must try to understand > >_how_ it works! > > It breaks down as > > :g/pattern1/action > > where pattern1 is "find the beginning of a paragraph" and action is > "<range>j" to join a range. The range happens to be "from this > currently-matching line through the last line in the paragraph". If > you have truly blank lines (no whitespace on them) and blank lines > at the top and bottom, you could simplify it to something like > > :g/\n\@<=\n/,/\n\n/j > > instead of messing with the "\%$" and "\%^" (end/start-of-file) and > attempting to ignore empty-ish (whitespace-only) lines. > > -tim >
Thanks - very illuminating. -- Anthony Campbell - a...@acampbell.org.uk Microsoft-free zone - Using Debian GNU/Linux http://www.acampbell.org.uk - sample my ebooks at http://www.smashwords.com/profile/view/acampbell -- 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