Breaking sentences into separate lines with Vim

I just read somewhere that when writing LaTeX documents it’s useful to have each sentence on a new line. My current document only has (double) line breaks between paragraphs. Here is how to use Vim to insert line breaks after each full stop.

In command mode press ‘:’ then enter s/\.\s\+/\.^M/. The ^M character represents a line break and must be inserted with CTRL-V Enter. Press enter to run the substitution on the current line. Add a percent character to run the substitution on the whole file: %s/\.\s\+/\.^M/.

Some more useful commands in a SunWorld article from 1997.

This entry was posted on Thursday, July 30th, 2009 at 11:58:35 System/Localtime and is filed under LaTeX, Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply