On 2026-06-19 05:41,  Artyom Bologov wrote:

| | If the G/re/ command accepted a context argument, presumably dot
| | should still be set to the line matching /re/ so that a command could be
| | applied?
| |
| | Are you familiar with rlwrap <https://github.com/hanslub42/rlwrap>?
| | See, for example:
| |
| | <https://github.com/slewsys/ed#command-line-editing-and-history>
|
| I am familiar with rlwrap, and my own ed(1) wrapper
| <https://codeberg.org/aartaka/aed> uses it extensively.

Very interesting!  slewsys/ed has a -R option to handle ANSI color codes.
To edit, say, Lisp in color, the process is something like:

$ ed -Rp '*' ~/.emacs
196813
*,!pygmentize -l lisp
522289
*...  edit in color ...
*,!ansifilter -p
197866
*wq
197866
$

Without option -R, paging doesn't work properly.

| | Being able to display matching lines in context, as mentioned
| | previously, along with easily recalling previous commands (e.g., with
| | <CTRL> + R) comes pretty close to what a visual editor can do.
|
| Yes, that’s what I’m aiming for. However, I don’t fully understand the
| approach you’re hinting at. Can you expand on that?

I was hoping that you could explain :) but going back to the command
G/re/, I find `/re/[' friendlier. This prints the matching line in
the context of either a full page or a few lines, depending on the window
size setting. To modify the matched line, I then run something like:

    ?re?s/old/new/

But if the context is too big or `re' is complex, then having access
to command-line history and editing really helps. Furthermore, by
using `/re/[', I'm not limited to a single command-sequence that G/re/
imposes.

For more involved edits, I find macros - which can be
used in global commands as well - convenient.

slewsys/ed has several scrolling commands: `z' (forward), `Z'
(backward), `]' (forward one-half) and `[' (backward one-half).
It's not the same as a visual editor, since I can't point and click.
But ed can be very efficient.

Reply via email to