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/layers/+lang/reasonml
2019-07-03 11:32:58 +03:00
..
config.el
funcs.el
layers.el
packages.el
README.org update .org tags 2019-07-03 11:32:58 +03:00

ReasonML layer

https://reasonml.github.io/img/reason.svg

Description

Spacemacs layer for ReasonML, based around reason-mode.

Features:

  • Syntax highlighting / indentation
  • Autocomplete (via merlin)
  • Lint / error display (via merlin, and flycheck if syntax-checking layer is enabled)
  • REPL via rtop
  • Auto-formatting (via refmt)

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.

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.

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.

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

Thanks

Special thanks to fredyr who wrote the initial verison of this layer.