← 返回命令列表

Linux command

utop 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start utop REPL

utop

Load a file into utop

utop -init [file.ml]

Start with specific library

utop -require [lwt]

Evaluate expression and exit

utop -e "[print_endline \"Hello\"]"

Start without initialization file

utop -no-init

说明

utop is an enhanced toplevel (REPL) for OCaml with features including real-time context-sensitive completion, syntax highlighting, history, and support for multiple editing modes. The completion bar displays possible completions as you type and updates dynamically. Navigate completions with Alt-Left/Right and select with Alt-Down. The interface supports multiline input without requiring explicit line continuation. utop integrates with Emacs using the Tuareg, caml, and ReasonML modes. From Emacs, use M-x utop to start a session with additional key bindings for evaluating code from buffers.

参数

-init _file_
Load specified file on startup.
-require _package_
Require specified findlib package.
-e _expression_
Evaluate expression and exit.
-no-init
Skip loading initialization files.
-emacs
Run in Emacs mode.
-stdin
Read input from standard input.
-help
Display help.

FAQ

What is the utop command used for?

utop is an enhanced toplevel (REPL) for OCaml with features including real-time context-sensitive completion, syntax highlighting, history, and support for multiple editing modes. The completion bar displays possible completions as you type and updates dynamically. Navigate completions with Alt-Left/Right and select with Alt-Down. The interface supports multiline input without requiring explicit line continuation. utop integrates with Emacs using the Tuareg, caml, and ReasonML modes. From Emacs, use M-x utop to start a session with additional key bindings for evaluating code from buffers.

How do I run a basic utop example?

Run `utop` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -init _file_ do in utop?

Load specified file on startup.