[plug] vim and paragraphs

Colin Muller colin at twobluedots.com.au
Tue Aug 27 12:15:33 WST 2002


On Tue, Aug 27, 2002 at 12:02:17PM +0800, Russell Steicke wrote:
> Can someone please tell me how to justify a paragraph using vim?  I
> keep starting it to edit small text documents, changing a couple of
> words, and ending up having to hand-edit all the lines in a
> paragraph to make it look pretty again.

:gq

(see :help gq)

I map Q to this in my ~/.vimrc:
map Q gq

Then you can reformat a para by going into it and typing:
:Q}

To reformat an arbitrary sequence of lines into a single para,
highlight them by typing v and moving the cursor up or down, then
type: Q}

This also correctly reformats lists of various sorts (like ones in
which each item starts with '- ')

Occasionally, I still have to fiddle with J to get everything into one
line before doing the :Q}, but in general this all works very
satisfactorily.

Colin



More information about the plug mailing list