dotfiles

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

commit edf5f905cfa8e4d5f41791abe7ead43b7070fa9a (patch)
parent 8f1d6a8a57e05e3f871ed8d9d777b7908a96ca70
Author: Alex Karle <alex@alexkarle.com>
Date:   Mon, 28 Sep 2020 23:40:00 -0400

bed: A slightly better take on The Standard Editor

I've been having a lot of fun learning about ed(1) and all its
quirks (basic regular expressions, etc). As a vi(m) enthusiast,
it seems like a good thing to learn (even just for BRE's, which
both sed and grep use by default).

In my adventures with ed(1), it's been decidedly easier to use
with rlwrap(1), a small program to wrap the input in readline
so that I get completions, history, and in-line editing (I mean,
ed(1) just uses getc(), which leaves it up to the kernel to
handle the buffered stdin stream (and it doesn't do arrow keys!)).

This small `bed` script is the outcome of my journey -- mostly
just a collection of rlwrap settings I like to use (ed(1) has no
settings :) ), along with a slightly tweaked inputrc for ed(1) use.

This commit message brought to you by `bed`. Maybe I'll come up
with a better name, but it hit the point of dotfile-check-in :)

Diffstat:
Abin/bed | 17+++++++++++++++++
Aetc/edinputrc | 7+++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/bin/bed b/bin/bed @@ -0,0 +1,17 @@ +#!/bin/sh +# bed -- [slightly] better ed +for f in .tags tags; do + if [ -e "$f" ]; then + echo "using tags from ./$f" + COMP="$COMP --file=$f" + fi +done + +export INPUTRC="$HOME/etc/edinputrc" + +exec rlwrap \ + --complete-filenames \ + --logfile /tmp/rled.log \ + --histsize 10000 $COMP \ + --extra-char-after-completion '' \ + ed -v -p"> " "$@" diff --git a/etc/edinputrc b/etc/edinputrc @@ -0,0 +1,7 @@ +$include ~/.inputrc + +# Since this is ed(1) we want to use C-n/C-p for +# completion (tabs should be tabs) +Control-n: complete +Control-p: complete-backward +TAB: tab-insert