Interpreters, e.g., k and q, sometimes have no command line history or editing.
A solution frequently recommended for k and q is rlwrap.
I find rlwrap too big and slow, especially for the tiny, fast k and q interpreters. It feels sluggish.
I have begun experimenting with "lile", a modified version of "ile" which apparently dates back to 1988. I have not seen it discussed anywhere on today's www.
It is small and fast. Custom key commands can be assigned per application using configuration files.
More info:
ftp://ftp7.FreeBSD.org/sites/ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/misc/lile/DESCR
ftp://ftp6.us.freebsd.org/mirror/FreeBSD-Archive/ports/distfiles/lile-2.0.tar.z
ftp://ftp.sra.co.jp/pub/os/NetBSD/NetBSD-current/pkgsrc/misc/lile/patches/patch-aa
Do HN readers have other suggestions?
Below are some familiar options I have explored.
Dates may be wrong.
linenoise (2010)
https://github.com/antirez/linenoise
libtecla (2001)
http://www.astro.caltech.edu/~mcs/tecla/
editline (1992)
https://thrysoee.dk/editline/
editline (1992)
https://github.com/troglobit/editline
readline (1989)
https://tiswww.case.edu/php/chet/readline/rltop.html