💾 Archived View for tilde.pink › ~kaction › log › 2021-06-08.1.gmi captured on 2023-06-14 at 14:29:48. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

On semantic linefeeds

There are three conventions for placing newlines in a text document.

The first convention is hard-wrapping text on some fixed column, like 72 or 80. One uses it when writing an email or plain-text documentation. Documents formatted with this convention look good even with bare essentials like ed(1) or cat(1).

The second convention is to put whole paragraphs into a single line. It makes it harder to read and write in the source but caters to reformating. I value the needs of those living in the console more than the needs of users of mobile devices, but I understand why Gemini settled on this convention.

The third convention is to put one sentence per line. Like the previous option, it looks terrible in the console but has a significant advantage -- patches look good. This convention is called semantic linefeeds.

https://rhodesmill.org/brandon/2012/one-sentence-per-line/

I always considered one paragraph per line as misguided heresy distributed by Google and GitHub, and I still maintain it. But semantic linefeeds have a real advantage over hard-wrapping: deleting a sentence from a paragraph and rewrapping it results in a messy +4/-5 patch. In contrast, semantic linefeeds result in a clean +0/-1 patch.

It is not an easy judgment, but I decided that I care about patches more. With the following configuration, vim enables using semantic linefeeds while maintaining visual presentation and editing convenience of hard-wrapping:

set columns=80
set wrap
set linebreak
noremap j gj
noremap k gk
noremap $ g$
noremap 0 g0

Yes, I realize that I just have passed a terrible threshold and may one day become Death Knight^W^W^W say "only Chrome >= 666 is supported" without guilt or remorse.