On Mon, Dec 18, 2000 at 08:34:37PM -0800, David Alban wrote:

> At 2000/12/18/16:48 -0800 Gary Johnson <[EMAIL PROTECTED]> wrote:
> > There's no really good way (i.e., none that I like) to automatically
> > reformat paragraphs within vim
> 
> Hmmm...  Maybe you'll like this.  Works for either vi or vim.  Define
> the following key mapping in .exrc or .vimrc: 
> 
> map } 0J071lBXi


> Then enter vi(m), position the cursor anywhere on the first line of a
> paragraph, and in command mode, press the '}' key repeatedly, with
> each press formatting the current line (which advances) so that it is
> not more than 72 characters long.

Thanks, David.  That does save a few keystrokes and would be handy when
using vi.  I often do something similar by first typing 'gqj' to
reformat the current line and the next line, then typing '.' to repeat
the operation down the page as many times as necessary.  This also works
for reformatting various styles of comments, including messages quoted
with leading '> '.

What I meant was that I haven't found a good way to have vim
automatically reflow the lines of a paragraph as I type, or when
changing from insert mode to command mode.  I've seen ways to do it, but
because vim doesn't distinguish among different paragraph types, all the
techniques I've seen assume that all paragraphs should be reformatted
when edited.  That doesn't work very well when editing other structures
such as tables.  Any technique that requires that I toggle some macro
mode for different paragraph types or end insert mode with a character
other than Escape is, to me, more bother than just using gq when
necessary.

Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | RF Communications Product Generation Unit
                             | Spokane, Washington, USA

Reply via email to