Own JS/CSS options

Saturday, March 3, 2012

I love my text editor

This text is a love declaration to my text editor. It's the most important tool on my computer (yes, more important than the web browser). It interconnects almost everything I do. And this is marvelous, because text editors are also one of the oldest tools still in use with only few conceptual changes since their inception.

But what makes text editors so great?

Side note: I am an Emacs user. This will contain some things that are more or less specific to Emacs. But this text is not about one text editor being better than some other. It's about text editors in general being such useful tools. And yes, your favorite text editor is, too.

Iterative Text Editing

What applications are useful obviously depends on usage patterns. If all you do with a computer is play video games, text editors won’t be particularly useful.

My main usage pattern on my computer is what I call iterative text editing. By this I mean that I primarily work with more or less structured text, and that I do not just write something down, but keep editing it over and over again. This somewhat abstract description refers to tasks such as writing blog posts, where I write down the text, read it, edit to improve it, re-read it, edit again, etc. Likewise, program source code or HTML files.

Contrast this with the usage patterns for listening to music, browsing the web, or editing videos. Even some usage patterns that involve writing text, like “microblogging,” differ in that they do not usually involve a lot of editing what has been written.

If you read the term “editor” in the meaning of a professional editor for books, who will read and re-read manuscripts from authors, annotate them with corrections and remarks, and sends them back to the author, the term “text editor” describes the usage pattern they excel at very well.

Text editors as a tool make this usage pattern easier for me because of two factors: A display that focuses on content, and, most importantly, an efficient way to interact with text.

Focus on Content

When receiving book manuscripts from authors, many publishers prefer to receive them with as little formatting as possible. This is not only because laymen are pretty bad at formatting, but also because formatting distracts from the content of the text itself.

This is why WYSIWYG tools are simply inferior for my purposes. They focus on formatting text nicely while I write it, but I would prefer not to format it at that point so I can focus on the content. Of course, I can do that with such tools as well—but then their main purpose is somewhat lost.

Interaction with Text

More importantly, though, what I need is strong support for editing and re-editing the text at hand. This requires powerful commands to edit text as well as powerful commands to move within the text.

Commands to edit text include commands such as spell checking, finding the correct spelling of a misspelled word, displaying synonyms and antonyms of words, and deleting text in various ways, such as word-forward, word-backward, until the end of the word, until the beginning of the word, etc. All these support the main task of editing and re-editing text.

To use them efficiently, it is important to be able to quickly and precisely move within the text. When I see a phrase I want to edit, I need to be able to move the input cursor there to start editing it as fast as possible.

Most WYSIWYG tools will happily assume you use a mouse for that. But that’s not efficient. I constantly read the text and find minor points to edit. Having to switch between keyboard and mouse all the time is tedious and slow.

Furthermore, for this purpose, pointing devices such as the mouse or, worse, touchscreens are too imprecise. I need to hit the exact spot where I want to edit, and not a character or three before, after, or in an adjacent line. Even on tablets, where I do not have to move my hands too far from the keyboard, this imprecision means that I need better tools than a touchscreen.

Text editors provide very powerful ways for moving within text. This includes skipping over characters, words, or paragraphs, but first and foremost a quick way to search for a phrase and jump there. If my eyes find a place I want to edit, a very simple keyboard command followed by a few characters from the spot I just read will put my input point right there. This is a crucial for fast navigation, but for some reason, word processors design their user interface so that searching is something special and out of ordinary, popping up new windows for that and whatnot. Unusable.

Finally, the much-maligned fixed-width fonts, while not even good for the low formatting to focus on content mentioned above, add another important aspect here: Fast matrix-based movement of the input cursor. Variable-width fonts mean that, when you move your input cursor up between lines, it will jump back and forth between columns, making it difficult to predict where it will end up. While not crucial, I think this also adds a lot to the ability to navigate text.

Unified User Interface

Text editors have more going for them still, though I think the above is their core strength. But another great thing I like about my text editor is the unified user interface.

The editor provides powerful editing commands. But those commands are not just available when I edit, say, blog posts. The same commands are also available when I edit Python code, HTML, chat, or e-mail. This is huge. It means, for example, that I do not need to worry about adding another spellchecker to each of my apps, it’s the same everywhere.

My text editor has a function that can look at a piece of text, interpret it as a calculation, and replace it with the result. This allows me to edit and re-edit even complex expressions with the power of my text editor, and then just get the result. And I when I added this feature, I didn’t just get this for my HTML code, I got the same for my IRC client, my blog posts, my program code, anything.

Recently, I decided to use Git as my source code management system. My editor provides support for that. But as it is not just my IDE, but my text editor, I do not only have this feature for my program code, I also get the same feature for my web pages, my blog posts, my manuscripts, my to-do lists, my configuration files… for free. All using the same interface.

Desktop environments and user interface guides have tried for a long time to unify the user interaction, but they have not come even remotely close to the way a text editor unifies how I interact with my computer.

Minor Details

A bit related to the above, good text editors are extensible. The function to quickly do a calculation was not part of the editor as shipped—it’s something I added myself. Quite a few of the features I use with my editor have been added by third parties. This utilizes the advantages of the unified user interface and makes it available everywhere.

I might add that more and more protocols on the internet are based on text as opposed to binary data. INI files, HTML, JSON, SQL, … they’re all text, and text editors are made to interact with those. A single tool to rule them all.

The Future

Text editors of the type we have today have been with us for about 40 years. They’re likely the oldest programs still in heavy use that have not fundamentally changed since the visual editor vi replaced the standard editor ed.1

They work extremely well for iterative text editing. As more and more people use computers for other tasks than that, they will become less and less widely used, but so far, nothing has shown up that can replace them for their main use. Some specialized environments, in particular for programming, have come up that can do specific tasks better than the editors, but they are crutches. Useful crutches, but still no replacements.

Moving within text seems to be a marginalized use. Most software designers seem happy to delegate this to the mouse or touchscreens and be done with it. But that’s not efficient.

Text editors have a lot to teach us about efficient computer interaction and unified user interfaces. So much, actually, that I guess they will stay with us for another decade or three.