A modular Vim/Neovim configuration

Home | About | Quick start guide | Documentation | Development | Community | Sponsors | 中文

Blogs » Use Vim as Elixir IDE

This is a general guide for using SpaceVim as a Elixir IDE, including layer configuration and usage. Each of the following sections will be covered:


Enable language layer

To add elixir language support in SpaceVim, you need to enable the lang#elixir layer. Press SPC f v d to open SpaceVim configuration file, and add following configuration:

  name = "lang#elixir"

for more info, you can read the lang#elixir layer documentation.

Code completion

The autocomplete layer is enabled by default.

Code formatting

Code formatting is provided by format layer. The default key binding is SPC b f. It will run mix format current_file. To enable code formatting feature for elixir, you need to load the format layer.

  name = "format"

Syntax lint

Syntax lint is provided by checkers layer. Error will be displayed in quickfix window after saving current file. This layer is enabled by default.

code running

The default code running key binding is SPC l r. It will run elixir current_file asynchronously. And the stdout will be shown on a runner buffer.


REPL support

Start a elixir inferior REPL process with SPC l s i. After the REPL process being started, you can send code to inferior process. All key bindings prefix with SPC l s, including sending line, sending selection or even send whole buffer.


Jump to test file

SpaceVim use vim-project to manager the files in a project, you can add a .projections.json to the root of your project with following content:

  "lib/*.ex": {"alternate": "test/{}.exs"},
  "test/*.exs": {"alternate": "lib/{}.ex"}

with this configuration, you can jump between the source code and test file via command :A

Task manager

To manage the task of elixir project, you need to create a task configuration file: .SpaceVim.d/task.toml.

For example:

    command = 'mix'
    args = ['test']
    command = 'mix'
    args = ['coveralls']

For more information about the task manager plugin, checkout the task documentation.

Powered by Jekyll