Window wrapping in TextMate

Three years ago, when I moved back to Macintosh from 7-8 years of Linux, I carried along a few habits. Some of these, like avoiding proprietary formats and using plain text files almost exclusively, still make sense to me. But other habits are losing their grip and falling into disuse. Today I may have lost another: setting my text editor to linewrap after a fixed number of characters.

Wrapping after a fixed number of characters is the norm in the Unix/Linux world. Text editors like Emacs, vi, and my personal favorite, NEdit, all wrap that way. It makes sense in that world because the Unix tradition is to put a newline character at the end of each line. Paragraphs are separated by double newlines, i.e., a blank line.

Part of the usual set of preferences for a Unix text editor is the column number to wrap at. Column 80 is a common choice because of the tradition of 80-column displays back in the pre-GUI days, but many people choose to wrap at 72 columns so their lines can be “quoted” by “> ” prefixes in emails without exceeding the historical 80-column barrier. I remember trying out a few values in the 72-78 range, hoping to find the perfect balance between “quotability” and having enough room to hold reasonable-length lines of code.

What, you may wonder, would happen when you were editing a paragraph and your insertions and deletions took you far away from the original line lengths? It turns out that all these editors had a reformat command that would pluck out the newlines from the current paragraph, rewrap the lines to the chosen length, and stick newlines back in at the end of each rewrapped line. In Emacs, the reformat command is Meta-q (let’s not get into what the “meta” key was), it’s Control-j in NEdit, and it’s some variant on “gq” in vim.

So anyway, wrapping at a particular column was ingrained in my text-editor work habits, and I set up both BBEdit (my editor of choice in 2005) and TextMate (my editor since 2006) to work that way, even though neither of them put newline characters at the end of each line. But yesterday I was reading about Scrivener and how it holds off on formatting the line lengths and page breaks until you’re ready to print. I don’t seem myself switching to Scrivener, but it did get me thinking that even though I write in plain text only, wrapping to a particular column was kind of unnecessary formatting. There are times when I’d like to have a narrow TextMate window on one side of the screen and a window with what I’m writing about on the other side. Wrapping at a given column forces me--for no good reason--to keep my TM window at least that wide and limits how big the other window can be.

The upshot is that today I set TextMate to wrap at the window width and another vestigial habit bit the dust.