3 ms·
ed is great when you want to make a quick edit while reviewing what's above the current line in the terminal. Spot a problem, edit a file, and write a commit me
by jpbpdx 6y ago
ed is great when you want to make a quick edit while reviewing what's above the current line in the terminal. Spot a problem, edit a file, and write a commit message while looking at the original problem, the solution, and the steps you took to get there.
ed is also nice if you otherwise want to remain in the cognitive context of the stuff that's already on your terminal. Sometimes that blink that occurs when blanking and replacing your primary visual field can be useful, sometimes not.
ed is a line editor. You know how lots of people like vi because it is so much easier to place the cursor where you want it? ed doesn't even have a cursor. This can be faster in some (rare) cases, but moreover it forces me to think about the file as a structure of code while visual editors generally allow me to be lazy and think about the file as an array of characters.
Finally, ed is great when you know what you want to read and/or write. It is like grep but with the ability to base the next command off the previous one, or to go result by result. It is like editing in place with sed but with far less hassle/risk for one-off changes. If you'd be doing the same thing in vi, you save the trouble of typing ':'.
Along those lines, ed becomes nicer for one-off edits when you compile it with PCRE support rather than the antique, POSIX-standard regular expression format.
For reviewing files on the side, open up another terminal window, read a named pipe, and write to that pipe from ed. Do this with three or four different terminals and you've got a fairly complex set of indirect buffers that can be updated with a bare minimum of tooling.
I wouldn't want to use only ed but I'd miss it if it went away.
- jolmg 6y ago> ed is also nice if you otherwise want to remain in the cognitive context of the stuff that's already on your terminal. Sometimes that blink that occurs when blanking and replacing your primary visual field can be useful, sometimes not. Indeed, the value of the terminal scroll-back buffer. One of the reasons I prefer CLI over TUI/GUI sometimes is that the terminal acts like a chat window with my computer. With programs like ed, you can review the conversation you've had with it.
- ansible 6y agoFor me, a lot of those use cases are covered by GNU screen. I can quickly switch between multiple terminals (which I label with names like 'edit', 'build', 'run', and 'console'). I've experimented with splitting a single window into multiple panes (GNU screen has slightly clunky support for this), but overall haven't found that to be as useful. I use the vim keys for viewing / copying the terminal window history as well as command-line history. For a long time I've eschewed using multiple tabs in Gnome Terminal, but I've started using those as well. Instead of having multiple terminal windows for different hosts, I just use different tabs, and switch between them via Ctrl-PageUp and Ctrl-PageDown. Another option there is to use another level of GNU screen with a different hotkey, but perhaps down that path lies madness.