crystal layer
Table of Contents
Description
This layer provides support for the Crystal language with the following features:crystal tool format
on file save- integration play.crystal-lang.org using play-crystal.el
- Linting with flycheck
- test runner (
crystal spec
) crystal tool
integration- interactive REPL (inf-crystal.el and icr)
Install
Pre-requires
Because the spacemacs master and develop branches are not compatible, so this project has two branches:
- master ->
spacemacs
master branch - develop ->
spacemacs
develop branch
Clone this repository into your ~/.emacs.d/private directory:
spacemacs
using master branchgit clone git@github.com:brantou/spacemacs-crystal-layer.git ~/.emacs.d/private/crystal
spacemacs
using develop branchgit clone -b develop git@github.com:brantou/spacemacs-crystal-layer.git ~/.emacs.d/private/crystal
To be able to connect to inf-crystal, you need to make sure that icr is installed. Installation instructions can be found on the main page of icr.
Layer
To use this configuration layer, add it to your~/.spacemacs
. You will need to
add crystal
to the existing dotspacemacs-configuration-layers
list in this
file.
Key bindings
Crystal commands:
Key Binding | Description |
---|---|
SPC m e b | play-crystal submit buffer |
SPC m e r | play-crystal submit region |
SPC m e e | play-crystal show code in a browser |
SPC m e i | download play-crystal snippet |
SPC m g a | jump to matching spec file or back from spec to code file |
SPC m g g | jump to definition |
SPC m g G | jump to definition in other window |
SPC m t b | run crystal spec for the current buffer |
SPC m t p | run crystal spec for the current project |
SPC m u c | show context |
SPC m u e | show macro expansion |
SPC m u f | format the current buffer |
SPC m u i | show implementations for given call |
SPC m x x | run crystal run for the current file |
inf-crystal
Start a inferior crystal REPL process with SPC m '
or SPC m s i
.
Send code to inferior process commands:
Key Binding | Description |
---|---|
SPC m ' | start inferior REPL process |
SPC m s b | send buffer |
SPC m s B | send buffer and switch to REPL |
SPC m s f | send function definition |
SPC m s F | send function definition and switch to REPL |
SPC m s i | start inferior REPL process |
SPC m s r | send region |
SPC m s R | send region and switch to REPL |
SPC m s s | switch to REPL |