For many decades, Emacs [gnu.org], a.k.a. Editing MACroS, has provided split-view management of documents (viewing and editing).
Emacs also excels with memory management of any sequence of typing or list of commands by storage in "registers", or complete repetition by a single press of any button desired (a.k.a. keyboard macros). The Emacs command "append-to-buffer" provides a means for selectively transferring content from any view of Emacs (whether a document or otherwise) to any other view, bypassing its own copy/paste or "registers".
On the other hand, the text editor Ed [gnu.org] reveals any fragments of any number of documents when requested, in any order, gradually filling the screen only as needed. Each line is called forth by its number, so the line number is an intuitive command that shows that line of text. With "ed", there is no need for moving a text cursor, no need for selecting text, and no need for scrolling.
Any comma-separated range of lines is a command for calling forth that range of lines, f.e. 31,35p will "print" lines 31 to 35 on the screen. Line numbers are optionally revealed when requesting lines (f.e. 31,35n), and similarly so in search results.
Specify a generic line number with plus or minus, f.e. -4 for the fourth line before the current line, or for a range of lines, f.e. -5,+5p to "print" the range of lines of text before and after the current line. The last line requested automatically becomes the current line.
Thereby with "ed", views of text emerge naturally from requested fragments of familiar documents: command, lines of text, command, lines of text, etc. That is, the typed command remains visible and serves as an introduction for the lines listed by it (when any).
A document can be viewed one screenful at a time (with z), or by an arbitrary number of lines (f.e. z30 for the next 30 lines), from anywhere within a document (f.e. 42z30n for the 30 lines starting from line 42, and numbered).
Search results are listable, or traversable one at time by line number in any order desired, and repeatable without retyping the search pattern. In addition to mere search and replace, a set of commands can be applied to all search results or interactively queried for each one. For example, search for a pattern, but also specifiy a different pattern for replacing in the results, all as one command, and either immediately or selectively.
As aforementioned, the editing commands typed in "ed" remain visible, thereby keeping a history of how a document was edited (optionally with the lines of text before and after they were modified) would be possible... if only there was a means for saving those proceedings.
By using "ed" for its naturally emerging document views within the "shell-mode" of Emacs, the "ed" program gains a separate dedicated buffer from Emacs recording that history of all editing with "ed", along with robust command editing (from the text editing commands of Emacs) when typing its own commands.
Of course, the aforementioned keyboard macros from Emacs means commands within "ed" are automatically added to any recorded sequence of tasks, and naturally so. No special effort needed, nothing new to learn, automatically incorporated.
Evoking "ed" within shell-mode with sudo
(super-user do) means the ability to edit restricted system documents without having to do "sudo
emacs", thereby the super-user role remains optional within Emacs.
With the "!
" command provided by "ed", evocation of external commands are possible from within "ed", and their results optionally read (r
) into that document wherever desired. Evoking "ed" as super-user (t.i. "sudo
ed") also means there is no longer any need to type sudo
for each and every command that requires super-user privileges, because the "!
" command of "ed" will invoke external commands with the same privileges by which "ed" itself was invoked.
The split-view management of Emacs provides the opportunity for multiple full-screen layouts of several such instances of "ed" and "sudo
ed" in shell-mode, intermixed with any other activities within Emacs, f.e. email, web browsing, directory listings, etc. As each instance has its own dedicated buffer, the editing history of commands used in "ed" or "sudo
ed" can be saved for review or potential selective restoration of edited documents (for when lines were listed before and after editing them).
And of course, repetition of super-user tasks, editing or otherwise, becomes possible (and naturally so) by means of the aforementioned keyboard macros of Emacs.
Using "sudo
ed" within shell-mode of Emacs enables responsible, recordable (t.i. record keeping), and administrative editing of documents or evocation of commands with access to copious amounts of copy/paste access (a.k.a. "registers"), and ridiculously easy on-the-fly record/play of any sequence of typing and commands... readily assigned to any button desired, as many as needed.