# Erlang/Elixir contribution layer for Spacemacs
![logo_erlang](img/erlang.png)
![logo_elixir](img/elixir.png) with ![logo_alchemist](img/alchemist.png)
**Table of Contents**
- [Erlang/Elixir contribution layer for Spacemacs](#erlangelixir-contribution-layer-for-spacemacs)
- [Install](#install)
- [Erlang](#erlang)
- [Enable EDTS](#enable-edts)
- [EDTS Key bindings](#edts-key-bindings)
- [Elixir](#elixir)
- [Elixir Key bindings](#elixir-key-bindings)
- [Compilation](#compilation)
- [Elixir Help](#elixir-help)
- [Elixir Mix](#elixir-mix)
- [Elixir Evaluation in place](#elixir-evaluation-in-place)
- [Elixir REPL interactions](#elixir-repl-interactions)
- [Elixir Tests](#elixir-tests)
- [Elixir Execute](#elixir-execute)
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(erlang-elixir))
```
## Erlang
### Enable EDTS
[EDTS][] is disabled by default, to enable it add the following snippet to
the `dotspacemacs/init` function of your `~/.spacemacs` file.
```elisp
(setq spacemacs-erlang-elixir-use-edts t)
```
Note that `EDTS` is disable on Windows.
#### EDTS Key bindings
Key Binding | Description
--------------------|------------------------------------------------------------
SPC m d | show man page documentation
SPC m e | go to next issue
SPC m g | go to definition
SPC m G | find a module in the current project
SPC m h | open the header file under point
SPC m l | find a function in the current module
SPC m m | go to the macro definition under point
SPC m r | go to the record definition under point
## Elixir
### Elixir Key bindings
#### Compilation
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m c b | Compile current buffer
#### Elixir Help
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m h : | Run custom search for help
SPC m h h | Show help of the current expression
SPC m h H | Toggle through search history
SPC m h r | Show help for current region
#### Elixir Mix
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m m : | Prompt for a `mix` command
SPC m m c | Compile the whole application
SPC m m h | Show help for a specific `mix` command
SPC m m i | Start `iex` in the context of an Elixir project
SPC m m x | Run the given expression in the Elixir application context
#### Elixir Evaluation in place
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m e b | Evaluate buffer
SPC m e B | Evaluate buffer and insert result
SPC m e l | Evaluate current line
SPC m e L | Evaluate current line and insert result
SPC m e r | Evaluate region
SPC m e R | Evaluate region and insert result
#### Elixir REPL interactions
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m s i | Start an `iex` inferior process
SPC m s l | Send current line to REPL buffer
SPC m s L | Send current line to REPL buffer and focus it in `insert state`
SPC m s r | Send region to REPL buffer
SPC m s R | Send region to REPL buffer and focus it in `insert state`
#### Elixir Tests
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m g t | Open the test file for current buffer
SPC m t a | Run all the tests
SPC m t b | Run all the tests from current buffer
SPC m t t | Run test under point
#### Elixir Execute
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m x : | Run a custom execute command with `elixir`
SPC m x b | Run the current buffer through `elixir`
SPC m x f | Run `elixir` with the given filename
[EDTS]: https://github.com/tjarvstrand/edts