~ / plaintextfiles.com / guides / line-discipline.md_

Line discipline

Especially when you are used to word processors, it can be hard to think of how you should change your approach to writing when you write plain text. But it helps that the changes you need to make are quite intuitive.

The ideal place to start is understanding the meaning of a line. This is both a mindset shift and a shift in practice.

Word processors think in terms of the finished, printed page. So they encourage you to think in terms of paragraphs. In plain text, paragraphs are mostly useless objects. Plain text files instead think in terms of lines. Think of lines as the basic segments with which plain text files operate. (They also do in terms of characters, but for our benefits let us talk of lines.) In addition, you can still think in terms of paragraphs but just for your own understanding of the overall theme of your writing.

One idea per line

When you write plain text, write one idea per line. If you are building an argument where you need a second and third idea to build on this one, and a fourth to wrap it all up, in plain text that means you write four lines, not one ‘paragraph’. This makes a lot of sense when writing outlines, but when you write prose often ideas are built across sentences, so in such cases write no more than one sentence per line, but write fewer if you must. In short, you could think of each line as a ‘unit of thought’.

If a new thing starts after a block of lines, you can leave a blank line in-between. A blank line generally signifies a new block of text to the plain text file, and it is the visual space that will signify something structural to you too. An example might clear this up. Here’s what would traditionally be a paragraph of text:

Peterhouse has always been one of the small colleges. Balsham founded it for a master, 14 fellows, and a few Bible clerks. In the time of Charles I. (1634) it maintained 19 fellows, 29 Bible clerks, and 8 scholars, making with the college officers and other students a total of 106. Sixty years earlier, when Caius wrote, there were 96 inmates, and in the middle of the xviii century, 90. To-day there are 11 fellowships, and 23 scholarships varying from £20 to £80 a year in value.

And how it is better written in a plain text file:

Peterhouse has always been one of the small colleges.
Balsham founded it for a master, 14 fellows, and a few Bible clerks.
In the time of Charles I. (1634) it maintained 
19 fellows, 29 Bible clerks, and 8 scholars, 
making with the college officers and other students a total of 106.
Sixty years earlier, when Caius wrote, there were 96 inmates, 
and in the middle of the xviii century, 90.
To-day there are 11 fellowships, and 23 scholarships 
varying from £20 to £80 a year in value.

You could then leave a blank line and continue with the rest of your text. As you can see, this is not too different from how you think of a ‘paragraph’ but it does make a meaningful difference in plain text as we shall see presently. Is this necessary? Not really. As with everything else in plain text, you can do as you please, but doing it this way is quite normal and for good reasons.

Semantic line breaking

When you search a word or phrase, you can then quickly get that line listed for you. When you have a search term in the middle of the paragraph, though, it becomes much harder to make sense of where things start and end.

Consequently, it becomes harder to also edit that file or edit across multiple files or to pull up searches across one or multiple files. After all, malleability is one of the great strengths of plain text so anything that can aid that is a good thing.

This practice has a name: semantic line breaking. In UNIX for Beginners Brian Kernighan writes, ‘Start each sentence on a newline. Make lines short, and break lines at natural places, such as after commas and semicolons, rather than randomly. Since most people change documents by rewriting phrases and adding, deleting and rearranging sentences, these precautions simplify any editing you have to do later.’

Derek Sivers has even more reasons why this practice can be helpful:

Where you break lines is also part of the technique. SemBr.org states the following about when to break lines:

Hard and soft wrapping

Let us return to our example to see how we broke lines there and why. Keep an 72 character limit in mind. If you are reading this website on anything larger than an iPad Mini, you will find that this column of text is already designed to be exactly 72 characters wide.

Consider the first long sentence:

In the time of Charles I. (1634) it maintained 19 fellows, 29 Bible clerks, and 8 scholars, making with the college officers and other students a total of 106.

At exactly 72 characters, this is how it breaks down if we impose a hard wrap:

In the time of Charles I. (1634) it maintained 19 fellows, 29 Bible cler
ks, and 8 scholars, making with the college officers and other students
a total of 106.

That is not very sensible. Instead we broke it down semantically in such a way that a logical pause after ‘maintained’ allowed us to write relevant numbers together. Then we broke it after a comma as semantic line breaking recommends we ‘should’ do.

In the time of Charles I. (1634) it maintained 
19 fellows, 29 Bible clerks, and 8 scholars, 
making with the college officers and other students a total of 106.

If this sounds complex, try breaking sentences where they make most sense to you as you are typing them and you will find that you naturally adhere to these very rules.

Having tried hard-wrapping and semantic line breaking, we can also try to soft-wrap our text instead. This is where we tell our application to maintain the 72 character width visually, without actually breaking any lines ourselves focussing instead on breaking lines based on sentences. In other words, there are no line breaks within a sentence in the file, but our editor ensures that longer lines wrap around purely visually.

In this case I would type my sentence in full and my application might present it this way:

In the time of Charles I. (1634) it maintained 19 fellows, 29 Bible 
clerks, and 8 scholars, making with the college officers and other
students a total of 106.

In fact, it is saved this way in my file:

In the time of Charles I. (1634) it maintained 19 fellows, 29 Bible clerks, and 8 scholars, making with the college officers and other students a total of 106.

Although individual lines do not break sensibly, this is still better than our first attempt at hard-wrapping at 72 characters exactly (which resulted in words breaking up). You might want to use this if you find it easier. But you lose out some of the malleability of text files. What you gain instead are lines that do not break unexpectedly on smaller screens like mobiles where a hard-wrapped 72 character line might break into two odd lines that are 65 and 7 characters wide.

In a sense then soft-wrapping is a modern solution to varying screen sizes. It is also a great solution when you can use, and prefer, a wider screen size for specific forms of prose or poetry where hard-wraps distract more than they help. It is like having most of the good stuff from both worlds.

Version control and publishing

Part of the malleability of plain text files is that when you make a new version of the file, having changed a few sentences here and there (or even several really), you will find that it is easier to maintain version history when your changes are isolated within lines rather than within paragraphs. Say I made a tine change in the excerpt above, re-writing ‘Charles I.’ and ‘Charles I’ (removing the old-school dot), it will become much easier for me to single out the line ‘In the time of Charles I. (1634) it maintained’ as the location where the change exists than it would be to comb through the entire paragraph.

When you publish this text somewhere, if you use popular approaches like Markdown, lines without a blank line separating them get collapsed anyway, which means your paragraphs remain intact. Blocks of lines become paragraphs, pretty much like you would expect. Our excerpt would turn out exactly like its printed counterpart whether we soft-wrapped sentences typed as individual lines or hard-wrapped them.

This reinforces the idea that following such line discipline works because plain text is written for your eyes only. This is where you want to ensure that your focus is on the contents of a file, on the words you are typing, the sentences you are framing, the phrases you are re-using and abusing and so on. It helps you remain aware of all that while also ensuring that your document remains publishable the moment you choose to convert it into another format.

See also: