Monday, February 7, 2011

Re: Reflowing paragraph text.

On 02/07/2011 04:42 PM, Thomas Adam wrote:
> Hi all,
>
> I am sure Vim has an option for this, so do please point me towards
> whichever documentation I need to read. :)
>
> Quite often, I have:
>
> :set tw=74
>
> Which is common for most text files and especially so when composing
> email. Vim makes a good job at automatically wrapping my text at 74
> characters as I type.
>
> However, let's say that I've typed a paragraph, and Vim's wrapped it
> all at 74 characters. Great. But I then have to insert text
> somewhere on a line in the middle of the paragraph. As soon as I do
> that, the indentation for the whole paragraph is broken. I usually do
> this by immediately pressing:
>
> gq}
>
> Which will either then reformat the paragraph correctly, or sometimes
> (and I don't know under what conditions this happens) will proceed to
> line-wrap more than the paragraph its been asked to.


It should work as long as it's a paragraph, i.e. separated by blank
lines. However if you have a line with spaces, it won't end current
paragraph. Also you can use gqap to format current complete paragraph.

To do auto-formatting, see :help fo-table , option 'a', so:

:set fo+=a

will take care of that.

HTH, -rainyday

--
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

No comments: