Text Editors Should Be Worse
By David Buchanan, 2nd January 2024
This is a rant. You have been warned!
I'd like text editors to be worse. Specifically, I'd like their default behaviour to be as close as possible to the median text input box you'd find in any piece of software, like the humble HTML
<textarea>. More realistically, I'd like a configuration preset that lets me opt in to the same, without having to hunt for a thousand individual setting tweaks. This opt-in should apply as globally as possible, perhaps as an environment variable.
My rationale is simple: I hate context switching. I want my input sequences to always work, no matter what software I'm using. Trying to apply deeply ingrained muscle memory in the wrong context and having it not work can be extremely frustrating.
As you can maybe guess from that, modal text editors like
vim don't work for me. Consider them to be outside the scope of this rant—I only care about text editors (and more broadly, text inputs) that are superficially "normal."
Let's take a concrete example: typing a quoted string. My go-to input sequence is to type
[left], i.e., typing two quotes at once and then moving the cursor back into the middle of the two, ready to type the string itself:
"|". That's three keystrokes, but in my brain it's a single action, and it works just about anywhere I might want to use it.
That is, everywhere except editors that try to be too smart. There are two common behaviours, both annoying in their own way:
"|", and finishing the input sequence results in
"|", pressing it again produces
""|, and pressing left results in
The first behaviour is obviously undesirable because it produced an unexpected result.
The second one produced the correct result, but I hate it even more! I hate it because it added a whole extra layer of "too smart" behaviour to try to counteract the first. That is, pressing
" with the cursor already in front of a
" character will not insert an additional
", but merely move the cursor to the other side of it. This works out alright in this particular scenario, but it's extremely confusing in any other situation where you happen to want to type a
" in front of an existing one. This might sound far-fetched, but it's the default behaviour of Firefox's dev console, and it's something I stumble over regularly.
I'm sure there's a setting I could tweak for this, but my problem is not Firefox; my problem is that these annoying behaviours are everywhere, and not just in relation to quoted strings.
When there's a problem "everywhere," it might seem like the best approach is to suck it up and get used to it. But I can't, because the problem isn't a specific behaviour; the problem is the divergence of behaviours. I can't possibly get used to all of them!
Defining the Problem
I'm going to name this annoyance "auto-input". Anything that inputs characters I didn't type for myself (or otherwise opt in to) is on my naughty list. This does not include input suggestions. For example, when typing a symbol name, an editor might offer a drop-down list of suggested completions that I can opt in to using the tab key. That's great because if I ignore the suggestion and continue typing obliviously, everything still works.
Text editors are encouraged to be smart, but that smartness shouldn't degrade the basics.
The one exception to my auto-input hatred is auto-indentation. When I press enter, I expect the new line to be pre-filled with the same leading whitespace as the line above. Anything that tries to be smarter than that, especially those that try to be language-aware, will likely get on my nerves too. And, if the indentation is spaces, pressing backspace should delete exactly one of them at a time. This is a matter of personal preference, but so is everything else in this article.
I'm too lazy to do any serious work towards a solution here, beyond writing this rant, but I would like to float the idea of a
NO_AUTOINPUT environment variable. If the variable is present on first-run of an application, it should set the appropriate settings defaults to minimise auto-input behaviours. After that, the settings can be tweaked per user preference.
For the sake of homogeneity, auto-indentation should be disabled with
NO_AUTOINPUT too. I'll accept the collateral damage of having to re-enable one setting, in the cases where I need it.