Skip to content

tarides/ocaml.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml.nvim

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.

Installation using lazy.nvim

Add the plugin to your lazy.nvim setup:

require("lazy").setup({
  { "tarides/ocaml.nvim",
    config = function()
      require("ocaml").setup()
    end
  }
})

Features

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.

Construct expression

Enables you to navigate between typed-holes (_) in a document and interactively substitute them:

  • JumpPrevHole: jump to the next hole
  • JumpNextHole: jump to the previous hole
  • Construct: open up a list of valid substitutions to fill the hole

Construct example

Source browsing

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

Jump example

  • PhrasePrev: jump to the beginning of the previous phrase
  • PhraseNext: jump to the beginning of the next phrase

Phrase example

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages