Is it possible to use arrow keys in OCaml interpreter?

末鹿安然 提交于 2020-01-01 01:17:23

问题


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 getting the same result in Ubuntu with bash. Also, same thing in ssh.


回答1:


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.




回答2:


Another option is to use: ledit ocaml

Although I prefer utop over anything else myself.



来源:https://stackoverflow.com/questions/13225070/is-it-possible-to-use-arrow-keys-in-ocaml-interpreter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!