This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/contrib/!lang/ocaml
Török Edwin 2bbcf8af76 ocaml: don't auto-close backticks
they are used for polymorphic variants, like `Foo
2015-06-11 23:24:44 -04:00
..
img Prefix categories with ! 2015-05-25 00:50:38 -04:00
config.el Prefix categories with ! 2015-05-25 00:50:38 -04:00
funcs.el Prefix categories with ! 2015-05-25 00:50:38 -04:00
packages.el ocaml: don't auto-close backticks 2015-06-11 23:24:44 -04:00
README.org Fix various key bindings in converted READMEs 2015-06-11 21:31:42 -04:00

Ocaml contribution layer for Spacemacs

/TakeV/spacemacs/media/commit/79f3d307fa31394d449430c43be2a6c311acbab8/contrib/!lang/ocaml/img/ocaml.png

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 contribution add it to your ~/.spacemacs

(setq-default dotspacemacs-configuration-layers '(ocaml))

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

Key Bindings

Key Binding Description
SPC m c c Compile
SPC m c p Check .merlin for errors
SPC m c r Refresh changed .cmis in merlin
SPC m e C Check for errors in current buffer
SPC m e n Jump to next error
SPC m e N Jump back to previous error
SPC m g a Switch ML <-> MLI
SPC m g b Go back to the last position where the user did a locate
SPC m g g Locate the identifier under point (same window)
SPC m g G Locate the identifier under point (different window)
SPC m g l Prompt for identifier and locate
SPC m g i Prompt for module name and switch to ML file
SPC m g I Prompt for module name and switch to MLI file
SPC m h h Document the identifier under point
SPC m h t Highlight identifier under cursor and print its type
SPC m h T Prompt for expression and show its type
SPC m r d Case analyze the current enclosing

REPL (utop)

Key Binding Description
SPC m s b Send buffer to the REPL
SPC m s B Send buffer to the REPL and switch to the REPL in insert state
SPC m s i Start a REPL
SPC m s p Send phrase to the REPL
SPC m s P Send phrase to the REPL and switch to the REPL in insert state
SPC m s r Send region to the REPL
SPC m s R Send 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

TODO Add more proper spacemacs key-bindings for basic merlin tasks

TODO Add proper keybindings for ocamldebug

TODO Add more keybindings for tuareg-mode