[英]Autocompletion in utop
I am sorry for the newb question, but I am just starting with OCaml and I could not find how to ues utop autocompletion. 我很抱歉这个新问题,但我刚开始使用OCaml而且我找不到如何使用utop自动完成功能。
When I start typing something in utop, I see a list of choices at the bottom of the shell. 当我开始在utop中输入内容时,我会在shell的底部看到一个选项列表。 If there is only one valid choice, pressing TAB will autocomplete what I am writing.
如果只有一个有效选项,按TAB将自动完成我正在写的内容。 But if there are multiple valid choices, and I spot the one I want, I have not found a way to select it (other than keep writing).
但是如果有多个有效的选择,并且我发现了我想要的那个,我还没有找到一种方法来选择它(除了继续写作)。
For instance (assuming I have imported Core.Std
) I type 例如(假设我已导入
Core.Std
)我输入
Float.of
The first suggestion is Float.of_float
, the second one is Float.of_int
. 第一个建议是
Float.of_float
,第二个建议是Float.of_int
。 How do I select the second one? 如何选择第二个?
To quote utop's README : 引用utop的自述文件 :
utop display a bar after the prompt which is used to show possible completions in real-time.
utop在提示后显示一个条,用于实时显示可能的完成情况。 You can navigate in it using M-left and M-right, and select one completion using M-tab.
您可以使用M-left和M-right在其中导航,并使用M-tab选择一个完成。 The M denotes the meta key, which is Alt most of the time.
M表示元键,大部分时间是Alt。
So, you can navigate through completions using Alt
. 因此,您可以使用
Alt
导航完成。
Have fun with utop! 与utop玩得开心!
EDIT: 编辑:
It seems Alt
doesn't always work, depending on the terminal. 似乎
Alt
并不总是有效,具体取决于终端。 Typing Esc
then the good keys, however, works. 然而,键入
Esc
然后好的键可以工作。
Also, the bindings can be easily rebinded through a ~/.lambda-term-inputrc
file, see here . 此外,绑定可以通过
~/.lambda-term-inputrc
文件轻松重新绑定,请参见此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.