I'm composing a plain text (.txt) document that has left-and-right justified paragraphs. I manually add spaces, breaking words with hyphens if necessary, until the lines are uniform length. To use an example from my document, a paragraph like this:
These phantasmic balls have some strange properties, some neat, some interesting, and others just indicative of lazy design. They're almost all caused by the same design flaw: The game treats them too much like regular balls.
will end up looking like this:
These phantasmic balls have some strange properties, some neat, some interesting, and others just indica- tive of lazy design. They're almost all caused by the same design flaw: The game treats them too much like regular balls.
I'm looking for a program that can do this for me. It's okay if the program only adds spaces (without breaking words over lines), but there MUST be some way to control the target width of the paragraph (in # characters). The example above is justified to 53 characters per line, but line width in my actual document varies from 60 to 79.
Bonus points if you can find a text editor with this feature integrated.
OpenOffice and TeX are not what I'm looking for; they just use formatting to change how the text is displayed. Also, nano's Justify command doesn't count because it doesn't actually make the lines uniform width.
Note: I accepted the following answer because it was the one that worked best for me. I found the emacs fill commands the easiest to use among the answers, and I appreciate how it recognizes even non-whitespace indentation (for stuff like # and // comments). However, the other answers all fill their own niches and I recommend others visiting this question to look at them as well.
