From 8b1dd067d6dd60f448ddce7977cc99c3aebd636b Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sun, 23 Jan 2022 23:14:54 -0500 Subject: [PATCH] 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 :) --- bin/e | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 bin/e diff --git a/bin/e b/bin/e new file mode 100755 index 0000000..07325fd --- /dev/null +++ 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'> ' "$@" -- libgit2 1.1.1