Saturday, October 22, 2011

Using vi key bindings in Perl's debugger on FreeBSD

Even after verifying that Term::ReadKey and Term::ReadLine were part of my perl distribution:

royce@heffalump$ perl -e 'use Term::ReadKey;'
royce@heffalump$ perl -e 'use Term::ReadLine;'
royce@heffalump$

... and making sure that vi key bindings were listed in my .inputrc:

royce@heffalump$ grep editing-mode ~/.inputrc
set editing-mode vi

... I still couldn't use 'em, as demonstrated by what happened when I tried to use movement keys:

DB<1> testtesttest^[[A

In my research, I discovered that Ubuntu folks were installing a different ReadLine. I eventually found the devel/p5-ReadLine-Perl port, which has this pkg-descr:

Perl 5 ships with a module called Term::ReadLine which is an interface
to command line editing and recall. The version that ships with Perl
is only a stub, and offers little functionality.

This module supplants the Term::ReadLine stubs with real command line
editing and recall facilities, written entirely in Perl. Applications
that use Term::ReadLine do not need to be modified to gain the benefits
of this package; it will happen transparently upon installation.

After installing p5-ReadLine-Perl, I'm up and running.