ReasonML layer
Table of ContentsClose
1. Description
Spacemacs layer for ReasonML, based around reason-mode.
1.1. Features:
- Syntax highlighting / indentation
- Autocomplete (via
merlin) - Lint / error display (via
merlin, andflycheckifsyntax-checkinglayer is enabled) - REPL via
rtop - Auto-formatting (via
refmt)
2. Install
To use this configuration layer, add it to your ~/.spacemacs. You will need to
add reasonml to the existing dotspacemacs-configuration-layers list in this
file.
This layer depends on the `ocaml` layer which should be installed automatically.
2.1. Merlin
You'll need merlin (binaries ocamlmerlin and ocamlmerlin-reason) installed
on your system and on your PATH for errors and auto-completion.
If you're familiar with opam you can
opam install merlin reason
to get ocamlmerlin and ocamlmerlin-reason on your current opam switch.
2.2. Refmt
Similarly to Merlin, you'll need the refmt binary on your path.
If you're familiar with opam you can
opam install reason
to get refmt in your current opam switch.
If your project depends on a specific version of refmt, you can set
refmt-command (via customize-mode or (setq refmt-command ..)) to the path
to a particular binary. You can also use the special values 'npm or 'opam to
run refmt via npx or opam exec, which will keep you on the correct version
for your current opam switch, or the project-local of node_modules.
You can toggle refmt on save with SPC m r t. To permanently enable it, add the layer variable:
(reasonml :variables reason-auto-refmt t)
in your dotspacemacs-configuration-layers.
3. Key bindings
The main key bindings, see packages.el for the main list.
| Key binding | Description |
|---|---|
SPC m g g |
Jump to definition |
SPC m g G |
Jump to definition (other window) |
SPC m g b |
Jump back |
SPC m h t |
Show type |
SPC m h h |
Show docs |
SPC m r d |
Merlin destruct |
SPC m = = |
Refmt |
SPC m t r |
Toggle auto-refmt on save |
SPC m = m r |
Refmt: convert ml syntax to re syntax |
SPC m = r m |
Refmt: convert re syntax to ml syntax |
4. Thanks
Special thanks to fredyr who wrote the initial version of this layer.