When I use readline, I would like to run an action if a key combination
is pressed.
Alt + cursor key left
Alt + cursor key right
In other words, I want the cursor key to do something, but only when it
is pressed in combination.
If this is not possible in Readline, perhaps someone knows how else to
fetch user input, including ALL possible key combination?
But, the problem also is … I do NOT want to press ENTER.
The user should just be able to press:
alt + cursor_key_left
And this should trigger something.
Is that even possible at all?
It’s possible but it’s not clear if you’re talking about invoking it in
irb or a unix shell. If in irb, you can invoke a ruby method as you’d
like if you put this in ~/.inputrc:
It’s possible but it’s not clear if you’re talking about invoking it in
irb or a unix shell. If in irb, you can invoke a ruby method as you’d
like if you put this in ~/.inputrc: