racketreadlineinput-history

How to configure the Racket interpreter to support command history?


I've just set up Racket and have been trying out the interpreter.

However, I can't seem to go up and down the command history using the arrows (or Ctrlp/Ctrln for that matter) or use Ctrlr to search through it.

Is that even supported? Can I build it with that feature in?

Coming from a Python background I'm very used to these features and would like to have them available for Racket too.


Solution

  • DrRacket IDE

    In the Racket IDE you can hold CTRL with arrow keys to get to previously written statements in the interactions window.

    Racket in terminal

    eXtended REPL

    Extended REPL gives read-line features like using arrows to go back in history as well as you can search with CTRL+r. It has in addition REPL-commands like ,apropos. By entering ,help you get a list of commands you can use or you can consult the documentation. To use it you can:

    1. enter (require xrepl) to activate it
    2. run racket with racket -il xrepl
    3. install it once and for all from xrepl by evaluating ,install!

    Standard readline

    You have normal readline which you can activate by:

    1. enter (require readline/rep) to activate it
    2. run racket with racket -il readline
    3. install in once and for all by evaluating (install-readline!).