dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 8b1dd067d6dd60f448ddce7977cc99c3aebd636b (patch)
parent 4fcc710721d5398aaf6d71b5402eefa7541c3d3c
Author: Alex Karle <alex@alexkarle.com>
Date:   Sun, 23 Jan 2022 23:14:54 -0500

bin: Add `e` program to launch ed(1) with a prompt

I'm back on the ed(1) train, and the prompt is definitely a must.
Pro tip of the day--I always wanted to filter lines through an
external program and read it back, and thought it wasn't possible
in one command. Something like vi's !motion command.

Turns out it is! The trick is that the `e` command can take in a
!command, *replacing the contents of the buffer without changing
the default filename*. So, to reformat the buffer, just write it
out first and then:

	> e !fmt < %

Voila! I used it on this commit :)

Diffstat:
Abin/e | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/bin/e b/bin/e @@ -0,0 +1,6 @@ +#!/bin/sh + +# NOTE: disabling rlwrap for now due to TAB being captured :( +# exec rlwrap ed -p'> ' "$@" + +exec ed -p'> ' "$@"