Provided by: ocp-indent_1.8.2-5build4_amd64 

NAME
ocp-indent - Automatic indentation of OCaml source files
SYNOPSIS
ocp-indent [OPTION]⦠[FILE]â¦
DESCRIPTION
Indent OCaml source files according to the official conventions, with a small number of tunable
parameters.
Outputs the indented version of each FILE given in the command line to standard output, unless invoked
with the `--inplace' option (see OPTIONS below). If no FILE is provided, reads from standard input.
CONFIGURATION
Parameters can be defined on the command-line via the --config option, or as a configuration definition
in one of the following, searched in order: a file named `.ocp-indent' in the current directory or its
parents (which allows for per-project indentation settings), the file
`$XDG_CONFIG_HOME/ocp/ocp-indent.conf', the file `$HOME/.ocp/ocp-indent.conf', or the environment
variable $OCP_INDENT_CONFIG.
A configuration definition is a list of bindings in the form NAME=VALUE or of PRESET, separated by commas
or newlines
Syntax: [PRESET,]VAR=VALUE[,VAR=VALUE...]
base=INT (default=2)
Indentation used when none of the following options applies.
let foo =
..bar
type=INT (default=2)
Indentation for type definitions.
type t =
..int
in=INT (default=0)
Indentation after `let ... in', unless followed by another `let'.
let foo = () in
..bar
with=INT (default=0)
Indentation after `match ... with', `try ... with' or `function'.
match foo with
..| _ -> bar
match_clause=INT (default=2)
Indentation for clauses inside a pattern-match (after arrows).
match foo with
| _ ->
..bar
ppx_stritem_ext=INT (default=2)
Indentation for items inside a [%%id ... ] extension node).
[%% id.id
..let x = 3 ]
max_indent=<INT|none> (default=4)
When nesting expressions on the same line, their indentations are stacked in some cases so that they
remain correct if you close them one per line. However, this can lead to large indentations in
complex code, so this parameter sets a maximum indentation. Note that it only affects indentation
after function arrows and opening parens at the ends of lines.
let f = g (h (i (fun x ->
....x)
)
)
strict_with=<always|never|auto> (default=never)
If `never', match bars are indented, superseding `with', whenever `match with' doesn't start its
line. If `auto', there are exceptions for constructs like `begin match with'. If `always', `with' is
always strictly respected, and additionally applies to variant types definition, for consistency.
Example with `strict_with=never,with=0':
begin match foo with
..| _ -> bar
end
strict_else=<always|never|auto> (default=always)
If `always', indent after the `else' keyword normally, like after `then'. If `auto', indent after
`else' unless in a few "unclosable" cases (`let .... in', `match', etc.). If `never', the `else'
keyword won't indent when followed by a newline.
Example with `strict_else=auto':
if cond then
foo
else
let x = bar in
baz
strict_comments=BOOL (default=false)
In-comment indentation is normally preserved, as long as it respects the left margin or the comments
starts with a newline. Setting this to `true' forces alignment within comments. Lines starting with
`*' are always aligned
align_ops=BOOL (default=true)
Toggles preference of column-alignment over line indentation for most of the common operators and
after mid-line opening parentheses.
Example with `align_ops=true':
let f x = x
+ y
Example with `align_ops=false':
let f x = x
+ y
align_params=<always|never|auto> (default=auto)
If `never', function parameters are indented one level from the line of the function. If `always',
they are aligned from the column of the function. if `auto', alignment is chosen over indentation in
a few cases, e.g. after match arrows
Example with `align_params=never':
match foo with
| _ -> some_fun
..parameter
Example with `align_params=always' or `auto':
match foo with
| _ -> some_fun
..parameter
Available presets are `normal', the default, `apprentice' which may make some aspects of the syntax more
obvious for beginners, and `JaneStreet'.
OPTIONS
-c CONFIG, --config=CONFIG
Configure the indentation parameters. See section CONFIGURATION for more information.
-d, --debug
Enable debug output to stderr.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto, pager, groff or plain. With auto,
the format is pager or plain whenever the TERM env var is dumb or undefined.
-i, --inplace
Re-indent files in-place.
--indent-empty
Return indent for empty lines, too. Especially useful with --numeric.
-l RANGE, --lines=RANGE (absent=-)
Only re-indent the lines in RANGE (eg. 10-12), adapting to the current indentation of surrounding
lines. Lines start at 1.
--load-mods=VAL
Load plugins.
--load-pkgs=VAL
Load plugins.
--numeric
Instead of re-indenting the file, output one integer per line representing the indentation value.
When specified together with --lines, only print as many values as lines in the range.
-o FILE, --output=FILE
Output to FILE. The default is to print to stdout.
--print-config
Print the current parameters to stdout and exit. (See section CONFIGURATION for more information.)
--syntax=VAL
Extend the handled syntax for OCaml syntax extensions.
--version
Show version information.
BUGS
Bugs are tracked on github at https://github.com/OCamlPro/ocp-indent/issues. The tests directory of the
source distribution is a good snapshot of the current status, and can be checked online at
http://htmlpreview.github.io/?https://github.com/OCamlPro/ocp-indent/blob/master/tests/failing.html
SEE ALSO
ocaml(1), ocp-index(1)
AUTHORS
Louis Gesbert and Thomas Gazagnaire from OCamlPro, from an original prototype by Jun Furuse.
LICENSE
Copyright (C) 2013 OCamlPro.
ocp-indent is free software, released under the terms of the GNU General Public License version 3, the
text of which can be found in the file `LICENSE' distributed with the sources.
Ocp-indent 1.8.1 OCP-INDENT(1)