Bigger scheme - sam's capsule: Making ed user-friedly - the silly way
/ \ /
k --- a b --- f
/ \ / \
me --- l i
\ / \ /
j --- c d --- e
\ /
g --- h
Most users of Unix, Linux and alikes came at least one in contact with the
subdued friendliness of the standard Unix editor, ed[1].
Some, after throwing themselves in despair on their keyboards, hitting by pure
accident their entry password back to normal life ('q') ran away, screaming and
not looking back.
Some, more resilient, decided to stand their ground and wrestle the beast.
Unsurprisingly, when you man[2] up, it's possible. I guess ed and I are on
first-name basis...
Almost...
# Me $ ed # Ed ?
Some might say it is _not_ user-friendly. I say - ed is just more particular
about who his friends are. You didn't swipe left on ed. Ed swiped left on you.
"But, if it was only a tiny bit friendlier..."
Hey, dude. Do you really want to muck around trying to improve on perfection?
Yeah... I thought so... Well...
Say hello to fred
aka FRiendly ED.
No, it's not a separate program, just a silly bash script wrapper with one dependency on top of that...
#----8<----- fred ------------- #! /bin/bash ed -v -p "ED (a)ppend, (i)nsert, (c)hange. Finish with '.' in a separate line. (d)elete, (,p)rint lines, (,l)ist special chars, print with (,n)umbers (w)rite file, (r)ead file, (e)dit file. /search. s/ubsti/tute/. (q)uit $(ruler) > " $@ #----8<----- end --------------
... and the dependency:
#----8<----- ruler -------------
#! /bin/bash
RULER=""
for ((i=0;i<$COLUMNS;i+=10)) ;do
RULER+="$(printf "%10.10d" $((i/10+1))|sed -e 's+^00000+0000:+g;s+0+.+g')"
done
echo -e "${RULER:0:COLUMNS}"
#----8<----- end --------------
Installation
Cut and save the snippets in files located somewhere in your PATH (~/bin ?)
Run `chmod +755 fred ruler` before giving it a try.
You can name `fred` whatever you like, but for sake of simplicity do not rename the `ruler` script[3]
----
[1] Standard editor
[2] `man 1 ed`
[3] You can of course use `ruler` independently from fred, for example to do this:
....:....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8....:....9....:...1.....:
See you then,
-- sam
Response: 20 (Success), text/gemini
| Original URL | gemini://rawtext.club/~samhunter/gemlog/2021-08-17-Making... |
|---|---|
| Status Code | 20 (Success) |
| Content-Type | text/gemini; charset=utf-8; lang=en |