Tuesday, December 1, 2009

Re: Custom Paragraph Formatting with gq

On Tue, Dec 01, 2009 at 01:05:32AM EST, Robert Chan wrote:
> I have logbook entries that have the following structure:
>
> [entry title 1]
> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse blandit
> ipsum vel elit ultrices pharetra rhoncus tellus aliquam. Donec quis dolor ac
> elit vestibulum rhoncus. Quisque adipiscing dolor vitae urna molestie in
> vulputate arcu mattis. Donec felis augue, aliquam dictum mattis vitae,
> pretium in massa.
>
> What I would like to do is apply 'gq' command to format all the paragraphs
> in the file, but the [entry title 1] header also gets formatted (which I
> don't want.) So it turns out something like this:

[..]

> Any ideas?
>
> (I've been reading 'formatoptions' and fo-table but could not find anything
> of related to custom paragraph settings.)

If you're in a rush, or just lazy, another option is to record a macro:

qr record macro name 'r'
o^[/[^MO^[?]^Mjjgqipjdd?]^Mjdd/[^M format one entry
q end recording
ugg undo and move to line 1

999@r replay 999 times

The macro actually works to some extent, and is a variation on adding blank lines
temporarily.

CJ

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: