1

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?

Community
  • 1
  • 1
gsmafra
  • 2,434
  • 18
  • 26
  • 2
    Your linked answer works. JLine uses .inputrc. – som-snytt Nov 28 '16 at 06:19
  • I have those commands on .inputrc and it doesn't result in the desirable behavior for me (it works for bash though). – gsmafra Nov 28 '16 at 15:17
  • 1
    WFM on 2.11.8, 2.12.0. They upgraded their JLine at some point, which might matter. Anyway thanks for the feature tip. It beats `:h? text`, `:line 2469`, up-arrow, by a lot. – som-snytt Nov 28 '16 at 17:50
  • You're right I installed 2.12.0 and it works now (I was using 2.11.6 that comes when I install scala via apt), you can answer the question I'll accept it – gsmafra Nov 28 '16 at 18:21

1 Answers1

3

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.

som-snytt
  • 39,429
  • 2
  • 47
  • 129