gsmafra gsmafra - 9 days ago 5
Linux Question

History/partial search with up-arrow on scala shell

How can I make the scala interactive shell program behave this way (using the up-arrow to go to the last command if I haven't typed anything or go to the last command given in the shell beginning with what I typed) instead of the reverse-i-search?

Answer

The Scala REPL uses JLine for readline functionality, and current versions support these .inputrc mappings:

## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward

and they work as you describe, enter a line prefix then up-arrow.

Probably the clunky :h? command can be retired. Or I guess that finds text anywhere on a line. :history line numbers are still useful for :edit 2463+10.