简体   繁体   English

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

[英]how to repeat last command in OCaml interpreter shell

I've been trying out OCaml.我一直在尝试 OCaml。 Sometimes its quicker just to test out some code using the interpreter shell but, it doesn't bring up the last command when I press the 'up' key.有时只是使用解释器外壳测试一些代码会更快,但是当我按下“向上”键时它不会调出最后一个命令。

Its a pain when I miss type something or wish to see what a little variation would produce.当我错过输入某些东西或希望看到一点点变化会产生什么时,这是一种痛苦。

Anyone know if there is another key for it?有谁知道它是否有另一个密钥?

Thanks,谢谢,

Use rlwrap :使用rlwrap

rlwrap ocaml

ocaml itself has no readline support. ocaml本身没有 readline 支持。

You can configure readline using ~/.inputrc .您可以使用~/.inputrc配置 readline。 For example, you could add such lines to it:例如,您可以向其中添加以下行:

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

Now you can use ctrl-o and ctrl-n hotkeys in ocaml .现在您可以在ocaml使用ctrl-octrl-n热键。 Just try it.去尝试一下。

You can use the improved toplevel utop .您可以使用改进的顶级utop Moreover, it includes nice completion capacities.此外,它包括很好的完成能力。

我使用 ctrl + 向上箭头作为上一个输入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM