Monday, July 6, 2009
vim paragraph reformat (justify or align)
I like editing my plaintext files (and some of my source code) at
The problem is that vim does not automatically justify or realign when adding/deleting text. The simple way to do it is to select the lines to format and use:
Note that since gq is an operator that you can use other ways to select the text to format, but visual mode is the most intuitive for me.
You could for example do this:
The downside is that you'd have to know the line count. A more useful text movement command to use with gq is ) (which moves you to the end of the current paragraph. So you'd do this: