Skip to content

Latest commit

 

History

History
 
 

ocaml

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Ocaml layer

img/ocaml.png

Table of Content

Description

This is a very basic layer for editing ocaml files.

Features:

  • Syntax highlighting (major-mode) via tuareg-mode
  • Error reporting, completion and type display via merlin
  • auto-completion with company mode via merlin
  • syntax-checking via flycheck-ocaml

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add ocaml to the existing dotspacemacs-configuration-layers list in this file.

OPAM packages

This layer requires some opam packages:

  • merlin for auto-completion
  • utop
  • ocp-indent

To install them, use the following command:

opam install merlin utop ocp-indent

Make sure opam is initialized and configured.

opam init
opam config setup -a

Key Bindings

Key BindingDescription
SPC m =Indent buffer.
SPC m c cCompile
SPC m c pCheck .merlin for errors
SPC m c rRefresh changed .cmis in merlin
SPC m e CCheck for errors in current buffer
SPC m e nJump to next error
SPC m e NJump back to previous error
SPC m g aSwitch ML <-> MLI
SPC m g bGo back to the last position where the user did a locate
SPC m g gLocate the identifier under point (same window)
SPC m g GLocate the identifier under point (different window)
SPC m g oList occurrences for identifier under point
SPC m g lPrompt for identifier and locate
SPC m g iPrompt for module name and switch to ML file
SPC m g IPrompt for module name and switch to MLI file
SPC m h hDocument the identifier under point
SPC m h tHighlight identifier under cursor and print its type
SPC m h TPrompt for expression and show its type
SPC m r dCase analyze the current enclosing

REPL (utop)

Key BindingDescription
SPC m s bSend buffer to the REPL
SPC m s BSend buffer to the REPL and switch to the REPL in insert state
SPC m s iStart a REPL
SPC m s pSend phrase to the REPL
SPC m s PSend phrase to the REPL and switch to the REPL in insert state
SPC m s rSend region to the REPL
SPC m s RSend region to the REPL and switch to the REPL in insert state
C-j(in REPL) next item in history
C-k(in REPL) previous item in history

TODOS

Add more proper spacemacs key-bindings for basic merlin tasks

Add proper keybindings for ocamldebug

Add more keybindings for tuareg-mode