<commit_before>*merlin.txt*	For Vim version 7.3 	Last change: 2013 March 30

                                Merlin ~

                Context sensitive completion for OCaml. ~

==============================================================================
COMMANDS                                                     *merlin-commands*

:SourcePath [dir]                                                *:SourcePath*

When dir is given adds, for the current session, the directory to the list of
directories where merlin looks for ml[i] files.

If no argument is given, it will list those directories.

:BuildPath [dir]                                                  *:BuildPath*

Same as |:SourcePath| but for cmi files.

:Use package [, package]*                                               *:Use*

Loads findlib packages (with completion) by adjusting buildpath to find files
from packages.

Tab completion on packages name is provided.

:Locate                                                               *Locate*

When called with no arguments tries to jump at the definition of the identifier
under the cursor.

When called with one argument tries to jump at the definition of the given
identifier, using the environment available at the cursor position.

:ML[I]                                                                   *:ML*

Quick switch to a source (resp. interface) file.
For instance, given moduleA.ml and moduleB.mli in source path, use: >
    :ML ModuleA
    :MLI ModuleB
<

:TypeOf [expr]                                                       *:TypeOf*

If given an expression, returns its type.
Otherwise, highlights the expression under the cursor and prints its type.
Use in conjunction with |:GrowEnclosing| and |:ShrinkEnclosing|.

Bound to <LocalLeader>t by default in normal mode.

:TypeOfSel                                                        *:TypeOfSel*

In visual mode, returns the type of the selected expression.

Bound to <LocalLeader>t by default in visual mode.

:GrowEnclosing                                                *:GrowEnclosing*

When |:TypeEnclosing| has been called, select the smallest expression
containing the previously highlighted expression.

:ShrinkEnclosing                                            *:ShrinkEnclosing*

When |:GrowEnclosing| has been called, revert to the previously selected
expression. (i.e. the largest expression, centered around the position where
|:TypeEnclosing| was called, which is contained in the currently highlighted
expression).

["r] :YankLatestType                                         *:YankLatestType*

Copy the latest shown type into register `"r`, or `""` if unspecified.

:ToggleTypeHistory                                        *:ToggleTypeHistory*

Reveals or hides a buffer containing a trace of all computed types.
See |merlin_type_history_height| and |merlin_type_history_auto_open|.

:Occurrences                                                    *:Occurrences*

List all occurrences of identifier under cursor in current buffer.
See |merlin_display_occurrence_list|.
Add these bindings to integrate the results into vim search (see |star|) >
  nmap <LocalLeader>*  <Plug>(MerlinSearchOccurrencesForward)
  nmap <LocalLeader>#  <Plug>(MerlinSearchOccurrencesBackward)
<

:Rename <ident>                                                      *:Rename*

Rename all occurrences of identifier under cursor to <ident>.
Add these bindings to rename interactively: >
  nmap <LocalLeader>r  <Plug>(MerlinRename)
  nmap <LocalLeader>R  <Plug>(MerlinRenameAppend)
<

==============================================================================
OPTIONS                                                       *merlin-options*


                                                    *'merlin_ignore_warnings'*
Default: false.
If you are using syntastic and don't want warnings notified, set the following
variable to {"true"} >
  let g:merlin_ignore_warnings = "false"
<

                                                         *merlin_highlighting*

The |:TypeEnclosing| commands highlights the expression under the cursor, the
related match group is {EnclosingExpr}. You can customize the highlighting
with the |:highlight| command, e.g. >
    hi EnclosingExpr ctermbg=17 guibg=LightGreen
<

                                                    *'merlin_move_to_project'*

Default: false.
If set to true, merlin will automatically change local directory of an ocaml
buffer to the root of the ".merlin" file. >
  let g:merlin_move_to_project = "true"
<
                                             *'merlin_display_occurrence_list'*

Default: true.
If set to true, merlin automatically displays the list of occurrences in a
separate window after a :Occurrences command. >
  let g:merlin_display_occurrence_list = 0
<

                                                  *'merlin_display_error_list'*

Default: true.
If set to true, merlin automatically displays the list of errors in a
separate window after a :ErrorCheck command. >
  let g:merlin_display_error_list = 0
<

                                                    *'merlin_close_error_list'*

Default: true.
If set to true, merlin automatically closes the list of errors if no error
was found after a :ErrorCheck command. >
  let g:merlin_close_error_list = 0
<
                                                 *'merlin_type_history_height'*

Default: 5.
The default height of the type history window.  If set to zero, merlin never
records any types in the history buffer. >
  let g:merlin_type_history_height = 0
<
                                              *'merlin_type_history_auto_open'*

Default: 5.
The maximum number of type lines to print in the statusbar before opening the
type history window.  If set to a very large number, merlin will never open
the type history window automatically. >
  let g:merlin_type_history_auto_open = 9999
<

                                                     *'merlin_textobject_grow'*
                                                   *'merlin_textobject_shrink'*
Default: unset.
Binds |text-objects| on the ocaml AST. For example: >
  let g:merlin_textobject_grow   = 'm'
  let g:merlin_textobject_shrink = 'M'
<
On their first call, `M` selects the current node while `m` selects something
bigger than a leaf.  Repeated use of `m` grow the selection and `M` shrinks
it back.  The variants `im` and `aM` behave similarly, but reduce the
selection by avoiding spaces and parenthesis; while `am` and `aM` expand it by
capturing the surrounding spaces.

In the following illustration, the cursor is represented by `[n]`:
>
                       ┌── aM ──┐
                       │ ┌─ M ─┐│
                       ↓ ↓     ↓↓
  let def = outer     (  in[n]er  stuff  )    more
            ↑     ↑   ↑  ↑            ↑  ↑  ↑    ↑
            │     │   │  └─ im ───────┘  │  │    │
            │     │   └────  m ──────────┘  │    │
            │     └──────── am ─────────────┘    │
            └────────────── 2m ──────────────────┘
                        (or mm)
<
<commit_msg>vim: update documentation (partially fix 346)<commit_after>*merlin.txt*	For Vim version 7.3 	Last change: 2013 March 30

                                Merlin ~

                Context sensitive completion for OCaml. ~

==============================================================================
COMMANDS                                                     *merlin-commands*

:SourcePath [dir]                                                *:SourcePath*

When dir is given adds, for the current session, the directory to the list of
directories where merlin looks for ml[i] files.

If no argument is given, it will list those directories.

:BuildPath [dir]                                                  *:BuildPath*

Same as |:SourcePath| but for cmi files.

:Use package [, package]*                                               *:Use*

Loads findlib packages (with completion) by adjusting buildpath to find files
from packages.

Tab completion on packages name is provided.

:Locate                                                               *Locate*

When called with no arguments tries to jump at the definition of the identifier
under the cursor.

When called with one argument tries to jump at the definition of the given
identifier, using the environment available at the cursor position.

:ML[I]                                                                   *:ML*

Quick switch to a source (resp. interface) file.
For instance, given moduleA.ml and moduleB.mli in source path, use: >
    :ML ModuleA
    :MLI ModuleB
<

:TypeOf [expr]                                                       *:TypeOf*

If given an expression, returns its type.
Otherwise, highlights the expression under the cursor and prints its type.
Use in conjunction with |:GrowEnclosing| and |:ShrinkEnclosing|.

Bound to <LocalLeader>t by default in normal mode.

:TypeOfSel                                                        *:TypeOfSel*

In visual mode, returns the type of the selected expression.

Bound to <LocalLeader>t by default in visual mode.

:GrowEnclosing                                                *:GrowEnclosing*

When |:TypeEnclosing| has been called, select the smallest expression
containing the previously highlighted expression.

:ShrinkEnclosing                                            *:ShrinkEnclosing*

When |:GrowEnclosing| has been called, revert to the previously selected
expression. (i.e. the largest expression, centered around the position where
|:TypeEnclosing| was called, which is contained in the currently highlighted
expression).

["r] :YankLatestType                                         *:YankLatestType*

Copy the latest shown type into register `"r`, or `""` if unspecified.

:ToggleTypeHistory                                        *:ToggleTypeHistory*

Reveals or hides a buffer containing a trace of all computed types.
See |merlin_type_history_height| and |merlin_type_history_auto_open|.

:Occurrences                                                    *:Occurrences*

List all occurrences of identifier under cursor in current buffer.
See |merlin_display_occurrence_list|.
Add these bindings to integrate the results into vim search (see |star|) >
  nmap <LocalLeader>*  <Plug>(MerlinSearchOccurrencesForward)
  nmap <LocalLeader>#  <Plug>(MerlinSearchOccurrencesBackward)
<

:Rename <ident>                                                      *:Rename*

Rename all occurrences of identifier under cursor to <ident>.
Add these bindings to rename interactively: >
  nmap <LocalLeader>r  <Plug>(MerlinRename)
  nmap <LocalLeader>R  <Plug>(MerlinRenameAppend)
<

:Destruct                                                          *:Destruct*

"destructs" the thing under the cursor, i.e.
- if the thing under the cursor is an expression, generates a pattern matching
  on it.
- if the thing under the cursor is a non-exhaustive pattern matching, makes
  the matching exhaustive
- if the thing under the cursor is a pattern variable or a pattern wildcard,
  refines that pattern (if possible).

See http://the-lambda-church.github.io/merlin/destruct.ogv

:Outline                                                           *:Outline*

Gives an "outline" of the current buffer, i.e. lists all the "definitions"
made in the buffer along with their kind (type definition, value definition,
module, etc.) and allows one to quickly jump at the (interactively) selected
definition.

The rendering (and interactivity) is provided by
[ctrl-p](https://github.com/ctrlpvim/ctrlp.vim).

:ILocate                                                           *:ILocate*

This is an interactive version of |:Locate|, which relies on 
[ctrl-p](https://github.com/ctrlpvim/ctrlp.vim).
It expects some input from the user, and then will list things in the
environment which name matches the user input.

Hitting enter will move you to the definition of the selected element.

==============================================================================
OPTIONS                                                       *merlin-options*


                                                    *'merlin_ignore_warnings'*
Default: false.
If you are using syntastic and don't want warnings notified, set the following
variable to {"true"} >
  let g:merlin_ignore_warnings = "false"
<

                                                         *merlin_highlighting*

The |:TypeEnclosing| commands highlights the expression under the cursor, the
related match group is {EnclosingExpr}. You can customize the highlighting
with the |:highlight| command, e.g. >
    hi EnclosingExpr ctermbg=17 guibg=LightGreen
<

                                                    *'merlin_move_to_project'*

Default: false.
If set to true, merlin will automatically change local directory of an ocaml
buffer to the root of the ".merlin" file. >
  let g:merlin_move_to_project = "true"
<
                                             *'merlin_display_occurrence_list'*

Default: true.
If set to true, merlin automatically displays the list of occurrences in a
separate window after a :Occurrences command. >
  let g:merlin_display_occurrence_list = 0
<

                                                  *'merlin_display_error_list'*

Default: true.
If set to true, merlin automatically displays the list of errors in a
separate window after a :ErrorCheck command. >
  let g:merlin_display_error_list = 0
<

                                                    *'merlin_close_error_list'*

Default: true.
If set to true, merlin automatically closes the list of errors if no error
was found after a :ErrorCheck command. >
  let g:merlin_close_error_list = 0
<
                                                 *'merlin_type_history_height'*

Default: 5.
The default height of the type history window.  If set to zero, merlin never
records any types in the history buffer. >
  let g:merlin_type_history_height = 0
<
                                              *'merlin_type_history_auto_open'*

Default: 5.
The maximum number of type lines to print in the statusbar before opening the
type history window.  If set to a very large number, merlin will never open
the type history window automatically. >
  let g:merlin_type_history_auto_open = 9999
<

                                                     *'merlin_textobject_grow'*
                                                   *'merlin_textobject_shrink'*
Default: unset.
Binds |text-objects| on the ocaml AST. For example: >
  let g:merlin_textobject_grow   = 'm'
  let g:merlin_textobject_shrink = 'M'
<
On their first call, `M` selects the current node while `m` selects something
bigger than a leaf.  Repeated use of `m` grow the selection and `M` shrinks
it back.  The variants `im` and `aM` behave similarly, but reduce the
selection by avoiding spaces and parenthesis; while `am` and `aM` expand it by
capturing the surrounding spaces.

In the following illustration, the cursor is represented by `[n]`:
>
                       ┌── aM ──┐
                       │ ┌─ M ─┐│
                       ↓ ↓     ↓↓
  let def = outer     (  in[n]er  stuff  )    more
            ↑     ↑   ↑  ↑            ↑  ↑  ↑    ↑
            │     │   │  └─ im ───────┘  │  │    │
            │     │   └────  m ──────────┘  │    │
            │     └──────── am ─────────────┘    │
            └────────────── 2m ──────────────────┘
                        (or mm)
<

                                                     *'merlin_completion_dwim'*
Default: true.
Whether to enable "smart" (a.k.a "do what I mean") completion.
If true, `L.m` will expand to >
  List.map
  List.m...
  ListLabels.map
  ...
<
if `L` doesn't exist.

Disable with: >
  let g:merlin_completion_dwim = 0
<

                                                 *'merlin_completion_arg_type'*
Default: "several".
Whether merlin should print the type of the expected parameter when completing
in an application context.
Possible option are:
>
  " always show the expected type
  let g:merlin_completion_arg_type = "always"

  " only show the expected type when there are more than one candidate
  let g:merlin_completion_arg_type = "several"

  " never show the expected type
  let g:merlin_completion_arg_type = "never"
<


                                                   *'merlin_locate_preference'*
Default: "ml".
Specifies whether you'd prefer |:Locate| and |:ILocate| to take you to .ml or
.mli files. >
    let g:merlin_locate_preference = 'mli'
<

{'fraction_non_alphanumeric': 0.09165559715010264, 'fraction_numerical': 0.0027774423378818984, 'mean_word_length': 1.959263891370377, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 112, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2456355', 'n_tokens_mistral': 4323, 'n_tokens_neox': 4144, 'n_words': 1669}