On Sun, Aug 06, 2006 at 04:01:57AM +0200, Penguin Lover Meino Christian Cramer squawked: > When writing "normal" text in Emacs or loading normal text into emacs > there was the possibility to reformat paragraphs wirh > "fill-paragraphs" (ALT-Q) so there were linebreaks inserted and > removed to make the paragraph fit best into the previously defined > width of the line. > > I cannot find this functionality in vim...is there anything like > that?
>From user_10.txt of the vim help manual: ===============begin quote==================== Now lines will be broken to take only up to 72 characters. But when you insert text halfway a line, or when you delete a few words, the lines will get too long or too short. Vim doesn't automatically reformat the text. To tell Vim to format the current paragraph: > gqap This starts with the "gq" command, which is an operator. Following is "ap", the text object that stands for "a paragraph". A paragraph is separated from the next paragraph by an empty line. Note: A blank line, which contains white space, does NOT separate paragraphs. This is hard to notice! Instead of "ap" you could use any motion or text object. If your paragraphs are properly separated, you can use this command to format the whole file: > gggqG "gg" takes you to the first line, "gq" is the format operator and "G" the motion that jumps to the last line. In case your paragraphs aren't clearly defined, you can format just the lines you manually select. Move the cursor to the first line you want to format. Start with the command "gqj". This formats the current line and the one below it. If the first line was short, words from the next line will be appended. If it was too long, words will be moved to the next line. The cursor moves to the second line. Now you can use "." to repeat the command. Keep doing this until you are at the end of the text you want to format. ==================end quote======================= HTH, W -- When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. Sortir en Pantoufles: up 10 days, 5:22 -- gentoo-user@gentoo.org mailing list