2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: Ocaml layer
|
2015-11-08 18:04:44 +00:00
|
|
|
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
[[file:img/ocaml.png]]
|
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
* Table of Content :TOC_4_org:noexport:
|
|
|
|
- [[Description][Description]]
|
|
|
|
- [[Features:][Features:]]
|
|
|
|
- [[Install][Install]]
|
|
|
|
- [[Layer][Layer]]
|
|
|
|
- [[OPAM packages][OPAM packages]]
|
|
|
|
- [[Key Bindings][Key Bindings]]
|
|
|
|
- [[REPL (utop)][REPL (utop)]]
|
|
|
|
- [[TODOS][TODOS]]
|
|
|
|
- [[Add more proper spacemacs key-bindings for basic merlin tasks][Add more proper spacemacs key-bindings for basic merlin tasks]]
|
|
|
|
- [[Add proper keybindings for ocamldebug][Add proper keybindings for ocamldebug]]
|
|
|
|
- [[Add more keybindings for tuareg-mode][Add more keybindings for tuareg-mode]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This is a very basic layer for editing ocaml files.
|
|
|
|
|
2015-06-10 21:16:01 +00:00
|
|
|
** Features:
|
2015-06-10 16:44:30 +00:00
|
|
|
- Syntax highlighting (major-mode) via [[https://github.com/ocaml/tuareg][tuareg-mode]]
|
|
|
|
- Error reporting, completion and type display via [[https://github.com/the-lambda-church/merlin][merlin]]
|
|
|
|
- auto-completion with company mode via [[https://github.com/the-lambda-church/merlin][merlin]]
|
|
|
|
- syntax-checking via [[https://github.com/diml/utop][flycheck-ocaml]]
|
|
|
|
|
|
|
|
* Install
|
|
|
|
** Layer
|
2015-06-12 01:23:07 +00:00
|
|
|
To use this contribution add it to your =~/.spacemacs=
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default dotspacemacs-configuration-layers '(ocaml))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** OPAM packages
|
2015-06-12 01:23:07 +00:00
|
|
|
This layer requires some [[http://opam.ocaml.org][opam]] packages:
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
- =merlin= for auto-completion
|
|
|
|
- =utop=
|
|
|
|
- =ocp-indent=
|
|
|
|
|
|
|
|
To install them, use the following command:
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh
|
|
|
|
opam install merlin utop ocp-indent
|
|
|
|
#+END_SRC
|
|
|
|
|
2015-10-01 14:20:04 +00:00
|
|
|
Make sure opam is initialized and configured.
|
|
|
|
|
|
|
|
#+begin_src sh
|
|
|
|
opam init
|
|
|
|
opam config setup -a
|
|
|
|
#+end_src
|
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* 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 |
|
|
|
|
|
2015-06-10 21:16:01 +00:00
|
|
|
* TODOS
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2015-06-10 21:16:01 +00:00
|
|
|
** TODO Add more proper spacemacs key-bindings for basic merlin tasks
|
|
|
|
** TODO Add proper keybindings for ocamldebug
|
|
|
|
** TODO Add more keybindings for tuareg-mode
|