Overview
Ocp-indent is an indentation tool for OCaml. Unlike Python, the level of indentation will not change the semantics of your OCaml program, but it will make it more or less readable. For complete styling you should use OCamlFormat and for indentation, Ocp-indent.
Key Concepts
Tuneable Parameters
The complete set of tuneable parameters are quite nicely given in the .ocp-indent
file for Ocp-indent itself. The simplest is the base parameter which will make sure code is indented in a standard way
(* base = 2 *)
let foo () =
^^bar ....
Syntax Extensions
Ocp-indent comes with useful extensions for the OCaml language - in particular you can use the mll extension for indenting the lexing file format.
In the Wild
Ocp-indent is used in the OCaml compiler repository.