[Vim] Wrapping indented paragraphs - Editors
This is a discussion on [Vim] Wrapping indented paragraphs - Editors ; How does one wrap indented (as opposed to double-linebreak delimited)
paragraphs in Vim?
Suppose I have the following text:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin
facilisis lacinia augue. Aliquam malesuada,
erat vel rhoncus
euismod, pede nulla congue ...
-
[Vim] Wrapping indented paragraphs
How does one wrap indented (as opposed to double-linebreak delimited)
paragraphs in Vim?
Suppose I have the following text:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin
facilisis lacinia augue. Aliquam malesuada,
erat vel rhoncus
euismod, pede nulla congue neque, vel convallis quam lacus non urna.
Vestibulum purus.
Vivamus ac felis vitae leo tristique adipiscing.
Ut eu risus nec ante scelerisque mattis. Donec ac nibh sit
amet magna aliquam
posuere. Vestibulum neque. Class aptent taciti sociosqu ad litora
torquent per conubia nostra, per inceptos himenaeos. Pellentesque
accumsan lobortis tellus. In mollis ante eu elit.
I want to rewrap these two paragraphs to fix their jagged right edges,
but I also want to preserve paragraph indentation. In Emacs one would
use M-q to do this. However, Vim considers this block as a single
paragraph due to the lack of a double linebreak, so {gq} clobbers the
whole thing into a single chunk of text.
Is there a good way to deal with this kind of formatting in Vim?
Thanks,
Mark
--
Mark Shroyer, http://markshroyer.com/contact/
-
Re: [Vim] Wrapping indented paragraphs
* Mark Shroyer wrote :
> How does one wrap indented (as opposed to double-linebreak delimited)
> paragraphs in Vim?
>
> Suppose I have the following text:
>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin
> facilisis lacinia augue. Aliquam malesuada,
> erat vel rhoncus
> euismod, pede nulla congue neque, vel convallis quam lacus non urna.
> Vestibulum purus.
> Vivamus ac felis vitae leo tristique adipiscing.
> Ut eu risus nec ante scelerisque mattis. Donec ac nibh sit
> amet magna aliquam
> posuere. Vestibulum neque. Class aptent taciti sociosqu ad litora
> torquent per conubia nostra, per inceptos himenaeos. Pellentesque
> accumsan lobortis tellus. In mollis ante eu elit.
>
> I want to rewrap these two paragraphs to fix their jagged right edges,
> but I also want to preserve paragraph indentation. In Emacs one would
> use M-q to do this. However, Vim considers this block as a single
> paragraph due to the lack of a double linebreak, so {gq} clobbers the
> whole thing into a single chunk of text.
>
> Is there a good way to deal with this kind of formatting in Vim?
Without knowing a better way of doing it, I'd visually select the
lines to format and hit "gq". Or you could count the lines to
format, place cursor on first line and hit "gq4j" for example to
format the 4 following lines plus the current one.
--
Troy Piggins | http://piggo.com/~troy __ ___
\ \ / (_)_ __ ,-O (o- O
\ V /| | ' \ O ) //\ O
Vim 7.2 \_/ |_|_|_|_| `-O V_/_ OOO