spacemacs/layers/+lang/ocaml
syl20bnr ebe4c60264 Revert "Defer packages by default using use-package-always-defer"
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.

The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
2018-03-03 23:40:10 -05:00
..
img
config.el Happy New Year 2018! 2018-01-04 02:00:25 -05:00
funcs.el Fix OPAM share directory in OCaml layer 2018-01-17 22:19:10 -05:00
packages.el Revert "Defer packages by default using use-package-always-defer" 2018-03-03 23:40:10 -05:00
README.org ocaml: mention ocaml flycheck/merlin configuration in README 2018-01-28 22:51:26 -05:00

Ocaml layer

/TakeV/spacemacs/media/commit/bf23cb17dd5b669b4ae5c14282d6868961f333bc/layers/+lang/ocaml/img/ocaml.png

Description

This is a very basic layer for editing ocaml files.

Features:

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.

Using merlin for error reporting

By default flycheck-ocaml is used for error reporting when the syntax-checking layer is also enabled as this is common throughout spacemacs. You can disable this and switch back to merlin's default error reporting method by adding flycheck-ocaml to your excluded packages list in .spacemacs:

dotspacemacs-excluded-packages '(... flycheck-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

Make sure opam is initialized and configured.

  opam init
  opam config setup -a

Key Bindings

Key Binding Description
SPC m = Indent buffer.
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 o List occurrences for identifier under point
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