This enlightens me as to how people can code with ed (and why Ken Thompson famously said 'I don't want to see the state of the file when I'm editing.'). It's basically a REPL for writing code. Same as psql, the commands you use to view the state of the text (database) are different from the commands you use to edit the state of the text (database).
Still sucks though. Even in psql I regularly drop into vim with \e to edit whole queries before sending them out.
Still sucks though. Even in psql I regularly drop into vim with \e to edit whole queries before sending them out.