74fdbb6795
Enabling a company backend for a specific mode was a tedious tasks with code scattered at different locations, one for local variable definitions, one for company hook function definitions and another where the backends were pushed to the local variables (which was problematic, since we ended up pushing the same backends over and over again with `SPC f e R`, pushes have been replaced by add-to-list calls in the new macro). All these steps are now put together at one place with the new macro spacemacs|add-company-backends, check its docstring for more info on its arguments. This macro also allows to define arbitrary buffer local variables to tune company for specific modes (similar to layer variables via a keyword :variables) The code related to company backends management has been moved to the auto-completion layer in the funcs.el file. A nice side effect of this move is that it enforces correct encapsulation of company backends related code. We can now easily detect if there is some configuration leakage when the auto-completion layer is not used. But we loose macro expansion at file loading time (not sue it is a big concern though). The function spacemacs|enable-auto-complete was never used so it has been deleted which led to the deletion of the now empty file core-auto-completion.el. The example in LAYERS.org regarding auto-completion is now out of date and has been deleted. An example to setup auto-completion is provided in the README.org file of the auto-completion layer. |
||
---|---|---|
.. | ||
img | ||
config.el | ||
funcs.el | ||
packages.el | ||
README.org |
Ocaml layer
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-completionutop
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 |