ocp-index is designed as a simple and light-weight documentation extractor for OCaml, for command-line use or integrated in other tools (e.g. for completion). It gathers information from .cmi (à la ocamlbrowser) and .cmt/cmti files, including structure, location, type, and ocamldoc comments when available.


ocp-index on Github Latest sources in the official GIT repository


ocp-index COMMAND params OPTIONS




make install

See below to compile and install the optional ocp-browser.

Other tools

Emacs mode

A script ocp-index.el is included under tools/, and can be used together with tuareg-mode or ocaml-mode and auto-complete (packaged as auto-complete-el in Debian) to get completions and types in a popup menu.

You can run the script tools/emacs-setup.sh to get hints on the configuration of emacs for ocp-index (it won't modify any files). Adding the following line to your .emacs:

(add-to-list 'load-path "/path/to/ocp-index.el/")
(require 'ocp-index)

Will give you:

See M-x customize ocp-index for more options.


A script ocp-index.vim, contributed by Daisuke Inajima, is available under tools. It supports:

To use, add vim-ocp-index directory to runtimepath:

:set runtimepath^=/path/to/ocp-index.vim

Then create your own after/ftplugin/ocaml.vim to override vim's builtin ocaml settings::

if exists('b:did_ftplugin_after')
let b:did_ftplugin_after = 1
call ocpindex#init()
nmap <buffer> K <Plug>(ocpindex-echo-type)
nmap <buffer> <C-]> <Plug>(ocpindex-jump)
nmap <buffer> <C-t> <Plug>(ocpindex-jump-back)

You get:

If needed, you can specify ocp-index path explicitly: let g:ocpindex_program = "/path/to/ocp-index"

Sublime Text

There is a binding written by Peter Zotov on Github


ocp-browser animated screenshot

A nice terminal interface leveraging the power of ocp-index is included. It provides a quick way to browser external and in-project interfaces. Thanks to the contribution from Gabriel Radanne.

To compile it, make sure that you have lambda-term installed, e.g. opam install lambda-term ocp-index.