Is it possible to use arrow keys in OCaml interpreter?

前端 未结 2 552
再見小時候
再見小時候 2021-02-07 01:37

Everytime I use these keys in the interpreter I keep getting symbols like this appearing:

[[D^[[C

I\'m using Linux Mint 12 in ZSH, however I\'m

2条回答
  •  别那么骄傲
    2021-02-07 02:11

    The stock OCaml toplevel doesn't have line editing built in. I use rlwrap:

    $ cat bin/ocaml
    #!/bin/sh
    exec rlwrap /usr/local/bin/ocaml "$@"
    

    Using the toplevel without something like this is quite painful, in my opinion!

    Other possibilities are to run the toplevel under emacs (a popular choice, I think), or to use utop. I haven't used utop, but it sounds cool.

提交回复
热议问题