Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在OCaml解释器shell中重复最后一个命令_Ocaml_Interpreter - Fatal编程技术网

如何在OCaml解释器shell中重复最后一个命令

如何在OCaml解释器shell中重复最后一个命令,ocaml,interpreter,Ocaml,Interpreter,我一直在试用OCaml。有时,使用解释器shell测试一些代码会更快,但当我按下“up”键时,它不会显示最后一个命令 当我漏打一些东西或想看看一点变化会产生什么时,这是一种痛苦 有人知道还有没有别的钥匙吗 谢谢,使用rlwrap: rlwrap ocaml ocaml本身不支持readline 您可以使用~/.inputrc配置readline。 例如,您可以向其中添加这样的行: $if ocaml "\C-o": "()\C-b" "\C-n": ";;\n" $endif 现在,您可以在

我一直在试用OCaml。有时,使用解释器shell测试一些代码会更快,但当我按下“up”键时,它不会显示最后一个命令

当我漏打一些东西或想看看一点变化会产生什么时,这是一种痛苦

有人知道还有没有别的钥匙吗


谢谢,

使用
rlwrap

rlwrap ocaml
ocaml
本身不支持readline

您可以使用
~/.inputrc
配置readline。 例如,您可以向其中添加这样的行:

$if ocaml
"\C-o": "()\C-b"
"\C-n": ";;\n"
$endif

现在,您可以在
ocaml
中使用
ctrl-o
ctrl-n
热键。试试看。

您可以使用改进的toplevel。
此外,它还具有很好的完成能力。

我在以前的输入中使用了ctrl+arrow up

还有
ledit
,它的工作原理类似于rlwrap:
ledit ocaml
。如果您使用的是Debian或Ubuntu.cool,我的Ubuntu机器上已经安装了ledit。rlwrap与
sudo-apt-get-install-rlwrap安装起来一样容易。。。一个比另一个有什么好处吗?@neildaemond:我发现
rlwrap
更好。rlwrap为您提供了历史记录、文件名完成、提示颜色、语法完成、括号匹配、使用外部编辑器以及通过.inputrc进行轻松配置。感谢您为您的答案添加了更多内容,rlwrap它是~I刚刚将
alias ocaml='rlwrap ocaml'
添加到my.bashrc:)