Sunday, July 23, 2006

Bash + Readline + Sanity

So yesterday, in a futile attempt to convince Firefox, X.org, Ubuntu, and a really large s5 presentation to work together without consuming ridiculous amounts of CPU I upgraded from Ubuntu Breezy to Ubuntu Dapper.

Naturally, tihs didn't actually fix anything of consequence, although it did give me a laptop that boots quite a bit faster (bonus!), and an X screen resolution control panel that is capable of controlling the resolution on more than one display (kind of slick).

Unfortunately, it broke my .inputrc, which sets up and down arrows to history-search-backward and hisory-search-forward respectively, and since I'm totally addicted to that feature I had to stop all productive work and find a way to fix it.

After flailing around hopelessly for a while, I came upon the /usr/share/doc/bash/inputrc.arrows file, which has various different ways to configure your arrow keys. Now just cut and pasting all of them into .inputrc didn't help much, well it did actually fix the problem I was working on, but it made me have to hit enter twice to do anything, which isn't really a step forward in my opinion. But after paring it down to just the basics, I found that the following worked:

set enable-keypad on
"\C-[OD" backward-char
"\C-[OC" forward-char
"\C-[OA" history-search-backward
"\C-[OB" history-search-forward

Previously I had gotten away with:

"\M-[A": history-search-backward
"\M-[B": history-search-forward
"\M-[C": forward-char
"\M-[D": backward-char

This worked on dozens of systems, and I still have no idea why it stopped working, but whatever...

Just figured I'd post it in case anyone else has the same problem, or, more likely, I have the same problem again and need to look up what I did to fix it ;-)