ocaml.nvim
provides direct access to advanced ocamllsp
features without
requiring complex editor-side logic.
ocaml.nvim
aims to offer a fast, simple, and modular workflow in Neovim.
This plugin gives access to all the advanced Merlin commands not supported by
generic LSP clients, such as Construct, alternate between .mli
and .ml
files, etc.
Add the plugin to your lazy.nvim
setup:
require("lazy").setup({
{ "tarides/ocaml.nvim",
config = function()
require("ocaml").setup()
end
}
})
Here is the list of commands offered by ocaml.nvim
and their key binding.
All of the commands are detailed and illustrated in the following sections.
Important
This section only covers features specific to ocaml.nvim
.
However, the builtin LSP of Neovim already provides standards commands such as
go-to-definition and hover documentation.
Command | Default Binding | Available | Tests | Description |
---|---|---|---|---|
JumpPrevHole |
-- | ✅ | ✅ | Jump to the previous hole. |
JumpNextHole |
-- | ✅ | ✅ | Jump to the next hole. |
Construct |
-- | ✅ | ✅ | Open up a list of valid substitutions to fill the hole. |
Jump |
-- | ✅ | ❌ | Jumps to the referenced expression. |
PhraseNext |
-- | ✅ | ❌ | Jump to the beginnning of the previous phrase. |
PhrasePrev |
-- | ✅ | ❌ | Jump to the beginning of the next phrase. |
ErrorNext |
-- | ❌ | ❌ | Jump to the next error. |
ErrorPrev |
-- | ❌ | ❌ | Jump to the previous error. |
FindDefinition |
-- | ❌ | ❌ | Jump to definition (the implementation). |
FindDefinitionInNewWindow |
-- | ❌ | ❌ | -- |
FindDefinitionInCurrentWindow |
-- | ❌ | ❌ | -- |
FindIdentifierDefinition |
-- | ❌ | ❌ | -- |
FindIdentifierDefinitionInNewWindow |
-- | ❌ | ❌ | -- |
FindIdentifierDefinitionInCurrentWindow |
-- | ❌ | ❌ | -- |
FindDeclaration |
-- | ❌ | ❌ | Jump to declaration (the signature). |
FindDeclarationInNewWindow |
-- | ❌ | ❌ | -- |
FindDefinitionInCurrentWindow |
-- | ❌ | ❌ | -- |
FindIdentifierDeclaration |
-- | ❌ | ❌ | -- |
FindIdentifierDeclarationInNewWindow |
-- | ❌ | ❌ | -- |
FindIdentifierDeclarationInCurrentWindow |
-- | ❌ | ❌ | -- |
FindTypeDefinition |
-- | ❌ | ❌ | Jump to the type definition of the expression. |
FindTypeDefinitionInNewWindow |
-- | ❌ | ❌ | -- |
FindTypeDefinitionInCurrentWindow |
-- | ❌ | ❌ | -- |
InferInterface |
-- | ❌ | ❌ | Infer the interface for the current implementation file. |
AlternateFile |
-- | ❌ | ❌ | Switch from the implementation file to the interface file and vice versa. |
Search |
-- | ❌ | ❌ | Searches for a value by its type or polarity to included in the current buffer. |
SearchDefinition |
-- | ❌ | ❌ | Searches for a value definition by its type or polarity. |
SearchDefinitionInNewWindow |
-- | ❌ | ❌ | -- |
SearchDefinitionInCurrentWindow |
-- | ❌ | ❌ | -- |
SearchDeclaration |
-- | ❌ | ❌ | Searches for a value declaration by its type or polarity. |
SearchDeclarationInNewWindow |
-- | ❌ | ❌ | -- |
SearchDeclarationInCurrentWindow |
-- | ❌ | ❌ | -- |
Document |
-- | ❌ | ❌ | Documents the expression below the cursor. |
DocumentIdentifier |
-- | ❌ | ❌ | Enables you to enter an identifier (present in the environment) and return its documentation. |
Destruct |
-- | ❌ | ❌ | Allows you to generate and manipulate pattern matching expressions. |
TypeExpression |
-- | ❌ | ❌ | -- |
TypeEnclosing |
-- | ❌ | ❌ | Display the type of the selection and start a "type enclosing" session. |
Occurences |
-- | ❌ | ❌ | Returns all occurrences of the identifier under the cursor. |
Rename |
-- | ❌ | ❌ | Rename the symbol under the cursor. |
Enables you to navigate between typed-holes (_
) in a document and
interactively substitute them:
JumpPrevHole
: jump to the next holeJumpNextHole
: jump to the previous holeConstruct
: open up a list of valid substitutions to fill the hole
Allows you to navigate semantically in a buffer, passing from an expression to
the parent let
, the parent module
, the parent fun
and the parent match
expression.
It is also possible to navigate between pattern matching cases:
Jump
: jumps to the referenced expression
PhrasePrev
: jump to the beginning of the previous phrasePhraseNext
: jump to the beginning of the next phrase