Sync’ up! … without getting drained

sep 11

From Vim to Ed

I switched from Vim to Ed twelve months ago, and I wanted to report my findings on this strange downstream adventure I took.

I’d been using Vim since about 1998, and I hardly got close to mastering it after all those years. In fact, that was one of the reasons I thought of trying something like Ed: I was tired of turning a corner only to find a zillion other great features Vim offers.

I wanted to use an editor that didn’t have features that were constantly distracting me from what’s important: writing code.

The goods

Ed had one of the most fantastically steep learning curves in all my many years of nerding. This ol’ editor was so weird in so many ways, I almost lost heart right off the bat.

A good deal of the Ed ideas are forgotten in time. Nobody uses a line-based editor, so this was one strange playing field to get accustomed to.

However, once the learning curve was overcome, the terseness of what I could do became an asset.

In Vim, there’s a million different ways to get your cursor to zip all around. One of my favorites was w where on the line in question, all in normal mode, I could dart over to my change in word-step motion.

In Ed, the line in question is right there in front of you, and all you have is ‘regex’ as your weapon to swap one thing for another.

You’d be surprised how good one can get via this sole usage pattern. It’s not all that bad, and thankfully, some distributions of Ed have nice little shortcuts to make this all the less pedantic.

With only a few agilities, Ed limits your usage to x, y, and z. The result? You get so darn good at those.

Another powerful plus for Ed, is its undo/redo limitation.

Usually, one would think, that after some hacking, one would want to undo changes that happened twenty edits ago. In Vim, you’d just hold down u until it gets to that state. In Ed, the buffer is limited to one undo. Incredibly, this limitation has never ruined my day. Because of my foreknowledge that Ed can’t undo twenty edits ago, my approach on edits has been ‘Edified,’ and my behavior is in sync with this one undo world.

I don’t pop open Vim ever, except to run a spell check on something that isn’t code (like this blog post, for example). Fascinating to me: one of the side effects of Ed is my spelling got a lot better. I’m more careful about what I type, as the pain to undo or edit things is quite real. Go figure!

The bads

Vim offers so much, it’s hard to compare Ed to something this feature-rich. So, I won’t.

Rather, I’ll just jot down some of my Ed-related gripes.

First, one can scroll forward a page via z in Ed, but one cannot do the reciprocal. I was so bummed out on day one regarding this, and I’m still bummed out 365 days later. What I find shocking, is that UNIX mail has z to go forward a page in header listings, and also z- to go back a page. If only this was baked into Ed from the start. My workaround is terrible, and funny as it may sound, when I’m fatigued, I sometimes try z- to see if it magically started working.

Perhaps more of a gripe to the authors of sed rather than Ed, but I wish there was a 100% compatibility with ‘regex’ substitution patterns that are valid in Ed, but in sed. This is not the case, and it’s a shame. In general, one has to forget about Ed’s awesome shorthand tricks to get sed to work. It would be great if the bounty of Ed vocabulary I’ve built up just simply worked one-for-one in sed.

More Ed for me

One year dedicated to Ed is probably enough time to arrive at a plateau of know-how where the limitations will remain as such, and the pains can’t be overcome with any more learning. That said, I think I’ve arrived at a comfortable spot with Ed, and I’m going to stick it out with it!