1
2
3
4
5
6
7
8UTOP(1) General Commands Manual UTOP(1)
9
10
11
13 utop - Universal toplevel for OCaml
14
15
17 utop [ options ] [ object-files ] [ script-file ]
18
19
21 utop is a enhanced toplevel for OCaml with many features, including
22 context sensitive completion.
23
24 When you start utop what you see is the prompt followed by a bar con‐
25 taining words. This is the completion bar, it contains the possible
26 completion and is updated as you type. The highlighted word in the com‐
27 pletion bar is the selected word. You can navigate using the keys
28 Alt+Left and Alt+Right and you can complete using the currently se‐
29 lected word by pressing Alt+Tab (you can configure these bindings in
30 the file ~/.config/lambda-term-inputrc , see lambda-term-inputrc(5) for
31 details).
32
33 utop supports completion on:
34
35 * directives and directive arguments
36 * identifiers
37 * record fields
38 * variants
39 * function labels
40 * object methods
41
42 Colors are by default configured for terminals with dark colors, such
43 as white on black, so the prompt may looks too bright on light colors
44 terminals. You can change that by setting the color profile of utop.
45 For that type:
46
47 UTop.set_profile UTop.Light;;
48
49 You can then add this line to your ~/.config/utop/init.ml file.
50
51 To turn off utop's advanced prompt features, add the following to
52 init.ml to turn off respectively (a) colors and the upper information
53 line, and (b) the lower boxed list of possible completions:
54
55 #utop_prompt_dummy;;
56 UTop.set_show_box false
57
58 You can enable basic syntax highlighting in utop by writing a ~/.utoprc
59 file. See utoprc(5) for that.
60
61 Finally utop can run in emacs. For that you have to add the following
62 line to your ~/.emacs file:
63
64 (autoload 'utop "utop" "Toplevel for OCaml" t)
65
66 then you can run utop by pressing M-x and typing "utop". utop support
67 completion in emacs mode. Just press Tab to complete a word. You can
68 also integrate it with the tuareg, caml or typerex mode. For that add
69 the following lines to your ~/.emacs file:
70
71 (autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
72 (add-hook 'tuareg-mode-hook 'utop-minor-mode)
73
74
76 See utop --help for the the list of available options. There is consid‐
77 erable overlap with options available for ocaml(1).
78
79 A commonly used option is -require package to load package into the ex‐
80 ecution environment. It is equivalent to using #require from inside
81 utop(1).
82
83
84 -absname
85 Show absolute filenames in error message.
86
87 -I dir Add dir to the list of include directories.
88
89 -init file
90 Load file instead of default init file.
91
92 -labels
93 Use commuting label mode.
94
95 -no-app-funct
96 Deactivate applicative functors.
97
98 -noassert
99 Do not compile assertion checks.
100
101 -nolabels
102 Ignore non-optional labels in types.
103
104 -nostdlib
105 Do not add default directory to the list of include directories.
106
107 -ppx command
108 Pipe abstract syntax trees through preprocessor command.
109
110 -principal
111 Check principality of type inference.
112
113 -safe-string
114 Make strings immutable.
115
116 -short-paths
117 Shorten paths in types (the default).
118
119 -no-short-paths
120 Do not shorten paths in types.
121
122 -rectypes
123 Allow arbitrary recursive types.
124
125 -stdin Read script from standard input.
126
127 -strict-sequence
128 Left-hand part of a sequence must have type unit.
129
130 -unsafe
131 Do not compile bounds checking on array and string access.
132
133 -version
134 Print version and exit.
135
136 -vnum Print version number and exit.
137
138 -w list
139 Enable or disable warnings according to list.
140
141 -warn-error list
142 Enable or disable error status for warnings according to list.
143 See option -w for the syntax of list. Default setting is -a+31.
144
145 -warn-help
146 Show description of warning numbers.
147
148 -emacs Run in emacs mode.
149
150 -hide-reserved
151 Hide identifiers starting with a '_' (the default).
152
153 -show-reserved
154 Show identifiers starting with a '_'.
155
156 -no-implicit-bindings
157 Don't add implicit bindings for expressions (the default).
158
159 -implicit-bindings
160 Add implicit bindings: expr;; -> let _0 = expr;;
161
162 -no-autoload
163 Disable autoloading of files in $OCAML_TOPLEVEL_PATH/autoload.
164
165 -require package
166 Load this package.
167
168 -dparsetree
169 Dump OCaml AST after rewriting.
170
171 -dsource
172 Dump OCaml source after rewriting.
173
174 -help Display this list of options.
175
176 --help Display this list of options.
177
178
180 ~/.config/utop/init.ml
181 The initialization file of the toplevel.
182 ~/.ocamlinit
183 The alternative initialization file of the toplevel.
184 ~/.utoprc
185 The configuration file for utop. See utoprc(5).
186 ~/.config/lambda-term-inputrc
187 The file containing key bindings. See lambda-term-inputrc(5).
188
189
191 Jérémie Dimino <jeremie@dimino.org>
192
193
195 utoprc(5), lambda-term-inputrc(5), ocaml(1).
196
197
198
199 August 2011 UTOP(1)