lang/ocaml: update README
This commit is contained in:
parent
4c0eb989fb
commit
a736158dae
1 changed files with 56 additions and 50 deletions
|
@ -1,8 +1,23 @@
|
||||||
#+TITLE: :lang ocaml
|
#+TITLE: lang/ocaml
|
||||||
|
#+DATE: June 27, 2017
|
||||||
|
#+SINCE: v2.0.3
|
||||||
|
|
||||||
This module adds [[https://ocaml.org/][OCaml]] support, powered by [[https://github.com/ocaml/tuareg][tuareg-mode]].
|
* Table of Contents :TOC:
|
||||||
|
- [[#description][Description]]
|
||||||
|
- [[#module-flags][Module Flags]]
|
||||||
|
- [[#plugins][Plugins]]
|
||||||
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#features][Features]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#appendix][Appendix]]
|
||||||
|
- [[#commands][Commands]]
|
||||||
|
- [[#hacks][Hacks]]
|
||||||
|
|
||||||
+ Code completion, documentation look-up, code navigation and refactoring ([[https://github.com/ocaml/merlin/wiki/emacs-from-scratch][merlin]])
|
* Description
|
||||||
|
This module adds [[https://ocaml.org/][OCaml]] support to Doom Emacs, powered by [[https://github.com/ocaml/tuareg][tuareg-mode]].
|
||||||
|
|
||||||
|
+ Code completion, documentation look-up, code navigation and refactoring
|
||||||
|
([[https://github.com/ocaml/merlin/wiki/emacs-from-scratch][merlin]])
|
||||||
+ Type, documentation and function argument display on idle ([[https://github.com/Khady/merlin-eldoc][merlin-eldoc]])
|
+ Type, documentation and function argument display on idle ([[https://github.com/Khady/merlin-eldoc][merlin-eldoc]])
|
||||||
+ REPL ([[https://github.com/ocaml-community/utop][utop]])
|
+ REPL ([[https://github.com/ocaml-community/utop][utop]])
|
||||||
+ Syntax-checking (~merlin~ with [[https://github.com/flycheck/flycheck-ocaml][flycheck-ocaml]])
|
+ Syntax-checking (~merlin~ with [[https://github.com/flycheck/flycheck-ocaml][flycheck-ocaml]])
|
||||||
|
@ -10,75 +25,66 @@ This module adds [[https://ocaml.org/][OCaml]] support, powered by [[https://gi
|
||||||
+ Code formatting ([[https://github.com/ocaml-ppx/ocamlformat][ocamlformat]])
|
+ Code formatting ([[https://github.com/ocaml-ppx/ocamlformat][ocamlformat]])
|
||||||
+ Dune file format ([[http://dune.build/][dune]])
|
+ Dune file format ([[http://dune.build/][dune]])
|
||||||
|
|
||||||
* Table of Contents :TOC:
|
** Module Flags
|
||||||
- [[Module Flags][Module Flags]]
|
This module provides no flags.
|
||||||
- [[Prerequisites][Prerequisites]]
|
|
||||||
- [[Features][Features]]
|
|
||||||
- [[Configuration][Configuration]]
|
|
||||||
- [[Appendix][Appendix]]
|
|
||||||
- [[Commands][Commands]]
|
|
||||||
- [[Hacks][Hacks]]
|
|
||||||
|
|
||||||
* Module Flags
|
** Plugins
|
||||||
This module provides the ~+opam-site-lisp~ flag to compile editor support ~.el~
|
+ [[https://github.com/ocaml/tuareg][tuareg]]
|
||||||
files from opam's =site-lisp= directory.
|
+ [[https://github.com/ocaml/merlin][merlin]]
|
||||||
By default all editor plugins are installed from MELPA/GitHub even if the
|
+ [[https://github.com/Khady/merlin-eldoc][merlin-eldoc]]
|
||||||
corresponding =opam= package isn't installed.
|
+ [[https://github.com/OCamlPro/ocp-indent][ocp-indent]]
|
||||||
If this flag is enabled then you must have all of the packages listed in
|
+ [[https://github.com/flycheck/flycheck-ocaml][flycheck-ocaml]]*
|
||||||
=package.el= installed via =opam=.
|
+ [[https://github.com/ocaml-community/utop][utop]]*
|
||||||
|
+ [[https://github.com/ocaml-ppx/ocamlformat][ocamlformat]]*
|
||||||
To enable this, use:
|
+ [[https://github.com/ocaml/dune][dune]]
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(doom! :lang (ocaml +opam-site-lisp))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Prerequisites
|
* Prerequisites
|
||||||
It is highly recommended to install [[http://opam.ocaml.org/][opam]].
|
This module has no hard dependencies, but it is recommanded that you install
|
||||||
To get all the features you should also install these ~opam~ packages, however
|
[[http://opam.ocaml.org/][opam]] and the following opam (optional) packages:
|
||||||
they are not all required (features should be disabled gracefully when a tool is
|
|
||||||
missing):
|
|
||||||
#+BEGIN_SRC shell
|
#+BEGIN_SRC shell
|
||||||
opam install merlin utop ocp-indent dune ocamlformat
|
opam install merlin utop ocp-indent dune ocamlformat
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Features
|
* Features
|
||||||
+ the following files should have syntax highlighting support:
|
+ The following files should have syntax highlighting support: ~.ml{i,p,y,}~,
|
||||||
~.ml{i,p,y,}~, ~.eliom{i,}~, ~jbuild~, ~dune~, ~opam~
|
~.eliom{i,}~, ~jbuild~, ~dune~, ~opam~
|
||||||
+ =merlin-mode= is activated whenever a =.merlin= file is found (including in a
|
+ =merlin-mode= is activated whenever a =.merlin= file is found (including in a
|
||||||
parent directory) and =ocamlmerlin= executable is present
|
parent directory) and =ocamlmerlin= executable is present
|
||||||
+ line-based auto-indentation is provided by =ocp-indent= when installed
|
+ Line-based auto-indentation is provided by =ocp-indent=, if it is available.
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
+ if =:completion company= is enabled then autocomplete is provided by =merlin=
|
+ If =:completion company= is enabled then autocomplete is provided by =merlin=
|
||||||
+ when =:tools flycheck= is enabled then =flycheck-ocaml= is activated to do
|
+ When =:tools flycheck= is enabled then =flycheck-ocaml= is activated to do
|
||||||
on-the-fly syntax/type checking via =merlin=, otherwise this is only done when
|
on-the-fly syntax/type checking via =merlin=, otherwise this is only done when
|
||||||
the file is saved.
|
the file is saved.
|
||||||
+ spell checking is activated in comments if =:tools flyspell= is active
|
+ Spell checking is activated in comments if =:tools flyspell= is active
|
||||||
+ a REPL is provided if =utop= is installed and =:tools eval= is active
|
+ A REPL is provided if =utop= is installed and =:tools eval= is active
|
||||||
+ if =:editor format= is enabled, the =ocamlformat= executable is available and
|
+ If =:editor format= is enabled, the =ocamlformat= executable is available and
|
||||||
there is an =.ocamlformat= file present then =format-all-buffer= is bound to
|
there is an =.ocamlformat= file present then =format-all-buffer= is bound to
|
||||||
=ocamlformat=, otherwise to =ocp-indent=
|
=ocamlformat=, otherwise to =ocp-indent=
|
||||||
+ if =:editor multiple-cursors= is enabled then identifiers can be refactored
|
+ If =:editor multiple-cursors= is enabled then identifiers can be refactored
|
||||||
with =v R= and multiple cursors (this correctly matches identifier occurrences
|
with =v R= and multiple cursors (this correctly matches identifier occurrences
|
||||||
according to scope, it is not purely a textual match)
|
according to scope, it is not purely a textual match)
|
||||||
+ if =:emacs imenu= is enabled then top level symbols (modules, type, functions, etc.) can
|
+ If =:emacs imenu= is enabled then top level symbols (modules, type, functions,
|
||||||
be looked up using =SPC / i=
|
etc.) can be looked up using =SPC / i=
|
||||||
|
|
||||||
Run =make install= to install all packages, and =make doctor= to diagnose missing tools.
|
Run =bin/doom refresh= to install all packages and =make doctor= to diagnose
|
||||||
|
missing tools.
|
||||||
|
|
||||||
* Appendix
|
* Appendix
|
||||||
** Commands
|
** Commands
|
||||||
| command | key / ex command | description |
|
| Command | Key | Description |
|
||||||
|------------------------------+------------------+-----------------------------------------------------------|
|
|------------------------------+-----------+-----------------------------------------------------------|
|
||||||
| =merlin-type-enclosing= | =SPC m t= | display type under point |
|
| =merlin-type-enclosing= | =SPC m t= | display type under point |
|
||||||
| =tuareg-find-alternate-file= | =SPC m a= | switch between =.ml= and =.mli= |
|
| =tuareg-find-alternate-file= | =SPC m a= | switch between =.ml= and =.mli= |
|
||||||
| =merlin-locate= | =gd= | lookup definition |
|
| =merlin-locate= | =gd= | lookup definition |
|
||||||
| =merlin-occurences= | =SPC c D= | lookup references |
|
| =merlin-occurences= | =SPC c D= | lookup references |
|
||||||
| =merlin-document= | =K= | lookup documentation |
|
| =merlin-document= | =K= | lookup documentation |
|
||||||
| =merlin-imenu= | =SPC / i= | symbol lookup in file |
|
| =merlin-imenu= | =SPC / i= | symbol lookup in file |
|
||||||
| =merlin-iedit-occurrences= | =v R= | visual refactor identifier under point (multiple cursors) |
|
| =merlin-iedit-occurrences= | =v R= | visual refactor identifier under point (multiple cursors) |
|
||||||
| =utop= | =SPC o r= | open =utop= as REPL |
|
| =utop= | =SPC o r= | open =utop= as REPL |
|
||||||
| =utop-eval-region= | =SPC c e= | evaluate selected region in =utop= |
|
| =utop-eval-region= | =SPC c e= | evaluate selected region in =utop= |
|
||||||
|
|
||||||
** Hacks
|
** Hacks
|
||||||
+ =set-pretty-symbols!= is called with the full tuareg prettify symbol list, this
|
+ =set-pretty-symbols!= is called with the full tuareg prettify symbol list, this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue