In devel/rubygem-irb as of lang/ruby27, I found that the up/down cursor keys (for accessing recent commands) do not work. Instead, the keys ^P and ^N do work.
The immediate workaround is to invoke
In multiline mode ruby brings along it's own line editor, installed as devel/rubygem-reline. This one does also read ~/.inputrc, but it uses different key names. What brought me onto the proper track was this article. So what I actually need in .inputrc is this (with xterm):
Obviousely this may differ according to what terminal you are on, what termcap is used, and what keyboard (and keyboard driver) you have. (With
The immediate workaround is to invoke
irb --singleline
. But it also can be properly fixed. irb
knows two line-editing modes: singleline and multiline, where multiline is the default. In singleline mode it seems to use the line-editing from devel/readline (which will usually be installed if you install e.g. shells/bash). This was traditionally configured in ~/.inputrc, but it is not fully clear to me how this all relates nowadays, nor is it clear what happens if devel/readline is not installed - most of the configurations in .inputrc seem no longer to be used, and those that are, do not work everywhere).In multiline mode ruby brings along it's own line editor, installed as devel/rubygem-reline. This one does also read ~/.inputrc, but it uses different key names. What brought me onto the proper track was this article. So what I actually need in .inputrc is this (with xterm):
"\e[B": ed-next-history
"\e[A": ed-prev-history
Obviousely this may differ according to what terminal you are on, what termcap is used, and what keyboard (and keyboard driver) you have. (With
hd
you can see what your intended keys do actually send.)