261 lines
6.2 KiB
Groff
261 lines
6.2 KiB
Groff
\" utop.1
|
|
\" ------
|
|
\" Copyright : (c) 2011, Jeremie Dimino <jeremie@dimino.org>
|
|
\" Licence : BSD3
|
|
\"
|
|
\" This file is a part of utop.
|
|
|
|
.TH UTOP 1
|
|
|
|
.SH NAME
|
|
utop \- Universal toplevel for OCaml
|
|
|
|
.SH SYNOPSIS
|
|
.B utop
|
|
[
|
|
.I options
|
|
]
|
|
[
|
|
.I object-files
|
|
]
|
|
[
|
|
.I script-file
|
|
]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.B utop
|
|
is an enhanced toplevel for OCaml with many features, including context
|
|
sensitive completion.
|
|
|
|
When you start
|
|
.B utop
|
|
what you see is the prompt followed by a bar containing words. This is
|
|
the completion bar: it contains the possible completion and is updated
|
|
as you type. The highlighted word in the completion bar is the
|
|
selected word. You can navigate using the keys \fBM-Left\fR and \fBM-Right\fR
|
|
and select one completion using \fBM-down\fR. Here \fBM\fR represents the meta key,
|
|
which is \fBAlt\fR on most systems. You can configure these bindings in the file
|
|
.I ~/.config/lambda-term-inputrc
|
|
- see
|
|
.BR lambda-term-inputrc (5)
|
|
for details.
|
|
|
|
\fButop\fR supports completion on:
|
|
|
|
* directives and directive arguments
|
|
* identifiers
|
|
* record fields
|
|
* variants
|
|
* function labels
|
|
* object methods
|
|
|
|
Colors are by default configured for terminals with dark colors, such
|
|
as white on black, so the prompt may look too bright on light-colored
|
|
terminals. You can change that by setting the color profile of
|
|
utop. To do that, type:
|
|
|
|
UTop.set_profile UTop.Light;;
|
|
|
|
You can then add this line to your
|
|
.I ~/.config/utop/init.ml
|
|
file.
|
|
|
|
To turn off \fButop\fR's advanced prompt features, add the following to \fIinit.ml\fR
|
|
to turn off respectively (a) colors and the upper information line, and
|
|
(b) the lower boxed list of possible completions:
|
|
|
|
#utop_prompt_dummy;;
|
|
UTop.set_show_box false
|
|
|
|
You can enable basic syntax highlighting in utop by writing a
|
|
.I ~/.utoprc
|
|
file. See
|
|
.BR utoprc (5)
|
|
for that.
|
|
|
|
Vi edit mode is enabled by the command
|
|
|
|
#edit_mode_vi
|
|
|
|
It currently supports three vi modes: normal, insert, visual mode, and you can
|
|
get/set content with vim-like registers.
|
|
|
|
.I utop.el
|
|
is a package that provides
|
|
.B utop
|
|
integration with Emacs. The package allows you to run
|
|
.B utop
|
|
inside Emacs and to evaluate code in it straight from your source buffers
|
|
(with the help of \fIutop-minor-mode\fR).
|
|
The recommended way to install
|
|
.I utop.el
|
|
is via Emacs's built-in package manager \fBpackage.el\fR.
|
|
More detailed installation and configuration instructions may be found
|
|
on the project's code repository at \fIhttps://github.com/ocaml-community/utop\fR.
|
|
|
|
You can start \fButop\fR inside Emacs with \fBM-x utop\fR.
|
|
|
|
The default install also has a minor mode with the following key bindings:
|
|
|
|
\fBC-c C-s\fR Start a utop buffer (\fIutop\fR)
|
|
\fBC-x C-e\fR Evaluate the current phrase (\fIutop-eval-phrase\fR)
|
|
\fBC-x C-r\fR Evaluate the selected region (\fIutop-eval-region\fR)
|
|
\fBC-c C-b\fR Evaluate the current buffer (\fIutop-eval-buffer\fR)
|
|
\fBC-c C-k\fR Kill a running utop process (\fItop-kill\fR)
|
|
\fBC-c C-z\fR Switch to utop process (\fIutop-switch-to-repl\fR)
|
|
|
|
then you can run \fButop\fR by pressing \fBM-x\fR and typing "utop". \fButop\fR supports
|
|
completion in Emacs mode. Just press \fBTab\fR to complete a word. You can
|
|
also integrate it with the tuareg, caml or typerex mode. For that add
|
|
the following lines to your
|
|
.I ~/.emacs
|
|
file:
|
|
|
|
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
|
|
(add-hook 'tuareg-mode-hook 'utop-minor-mode)
|
|
|
|
.SH OPTIONS
|
|
See
|
|
.B utop --help
|
|
for the full list of available options. There is considerable overlap
|
|
with options available for
|
|
.BR ocaml (1).
|
|
|
|
A commonly used option is
|
|
\fB-require\fI package\fR
|
|
to load \fIpackage\fR into the execution environment. It is equivalent
|
|
to using \fb#require\fR from inside
|
|
.BR utop (1).
|
|
|
|
.PP
|
|
.TP
|
|
.BI -absname
|
|
Show absolute filenames in error message.
|
|
.TP
|
|
.BI -I " dir"
|
|
Add \fIdir\fR to the list of include directories.
|
|
.TP
|
|
.BI -init " file"
|
|
Load \fIfile\fR instead of the default init file.
|
|
.TP
|
|
.BI -labels
|
|
Use commuting label mode.
|
|
.TP
|
|
.BI -no-app-funct
|
|
Deactivate applicative functors.
|
|
.TP
|
|
.BI -noassert
|
|
Do not compile assertion checks.
|
|
.TP
|
|
.BI -nolabels
|
|
Ignore non-optional labels in types.
|
|
.TP
|
|
.BI -nostdlib
|
|
Do not add the default directory to the list of include directories.
|
|
.TP
|
|
.BI -ppx " command"
|
|
Pipe abstract syntax trees through the preprocessor \fIcommand\fR.
|
|
.TP
|
|
.BI -principal
|
|
Check principality of type inference.
|
|
.TP
|
|
.BI -safe-string
|
|
Make strings immutable.
|
|
.TP
|
|
.BI -short-paths
|
|
Shorten paths in types (the default).
|
|
.TP
|
|
.BI -no-short-paths
|
|
Do not shorten paths in types.
|
|
.TP
|
|
.BI -rectypes
|
|
Allow arbitrary recursive types.
|
|
.TP
|
|
.BI -stdin
|
|
Read script from standard input.
|
|
.TP
|
|
.BI -strict-sequence
|
|
Left-hand part of a sequence must have type unit.
|
|
.TP
|
|
.BI -unsafe
|
|
Do not compile bounds checking on array and string access.
|
|
.TP
|
|
.BI -version
|
|
Print version and exit.
|
|
.TP
|
|
.BI -vnum
|
|
Print version number and exit.
|
|
.TP
|
|
.BI -w " list"
|
|
Enable or disable warnings according to \fIlist\fR.
|
|
.TP
|
|
.BI -warn-error " list"
|
|
Enable or disable error status for warnings according to \fIlist\fR.
|
|
See option \fB-w\fR for the syntax of \fIlist\fR.
|
|
Default setting is \fB-a+31\fR.
|
|
.TP
|
|
.BI -warn-help
|
|
Show description of warning numbers.
|
|
.TP
|
|
.BI -emacs
|
|
Run in emacs mode.
|
|
.TP
|
|
.BI -hide-reserved
|
|
Hide identifiers starting with a '_' (the default).
|
|
.TP
|
|
.BI -show-reserved
|
|
Show identifiers starting with a '_'.
|
|
.TP
|
|
.BI -no-implicit-bindings
|
|
Don't add implicit bindings for expressions (the default).
|
|
.TP
|
|
.BI -implicit-bindings
|
|
Add implicit bindings: \fIexpr\fR;; -> let _0 = \fIexpr\fR;;
|
|
.TP
|
|
.BI -no-autoload
|
|
Disable autoloading of files in
|
|
.I $OCAML_TOPLEVEL_PATH/autoload.
|
|
.TP
|
|
.BI -require " package"
|
|
Load this package.
|
|
.TP
|
|
.BI -dparsetree
|
|
Dump OCaml AST after rewriting.
|
|
.TP
|
|
.BI -dsource
|
|
Dump OCaml source after rewriting.
|
|
.TP
|
|
.BI -help
|
|
Display this list of options.
|
|
.TP
|
|
.BI --help
|
|
Display this list of options.
|
|
|
|
.SH FILES
|
|
.I ~/.config/utop/init.ml
|
|
.RS
|
|
The initialization file of the toplevel.
|
|
.RE
|
|
.I ~/.ocamlinit
|
|
.RS
|
|
The alternative initialization file of the toplevel.
|
|
.RE
|
|
.I ~/.utoprc
|
|
.RS
|
|
The configuration file for utop. See
|
|
.BR utoprc (5).
|
|
.RE
|
|
.I ~/.config/lambda-term-inputrc
|
|
.RS
|
|
The file containing key bindings. See
|
|
.BR lambda-term-inputrc (5).
|
|
|
|
.SH AUTHOR
|
|
Jérémie Dimino <jeremie@dimino.org>
|
|
|
|
.SH "SEE ALSO"
|
|
.BR utoprc (5),
|
|
.BR lambda-term-inputrc (5),
|
|
.BR ocaml (1).
|