Mickey on Readline

Mickey has another great post that will be immediately useful to almost every Irreal reader. The post is about the functionality of the GNU readline library. As Mickey says, almost everyone knows that readline (or at least BASH) implements the basic Emacs (or Vim) cursor movement keybindings and almost as many know about moving backward in the command history with Ctrl+r. Sadly, that’s the extent of most people’s knowledge about readline. There’s a whole lot more, though.

Mickey notes that the problem is particularly acute with Emacs users because, after all, they mostly stay in Emacs and even deal with the shell through Emacs. That means they have all that functionality automatically so they never explore what readline is capable of. I know that’s true because I wrote about readline’s functionality back in 2019 and resolved at the time to do better about using readline’s editing capabilities. Of course, I didn’t and now I know why. As an Emacs user I just didn’t use readline enough for it to stick. On the other hand, it’s mostly the same Emacs so the muscle memory should already be there.

Probably the most surprising thing about readline—and its most unknown—is its macro capability. Very much like keyboard macros in Emacs, it’s possible to record, optionally save, and playback an input sequence. That has obvious applicability for repeatedly entering some complex input string or part of one. Mickey has lots of examples so be sure to check out his post. As always with Mickey’s offerings, your time will be more than repaid.

This entry was posted in General and tagged , . Bookmark the permalink.