2018-08-11 03:31:29 +00:00
#+TITLE : julia layer
2019-05-07 08:53:56 +00:00
#+TAGS : general|layer|multi-paradigm|programming
2019-05-05 17:26:40 +00:00
2018-08-11 03:31:29 +00:00
[[file:img/julia.png ]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2018-08-11 03:31:29 +00:00
- [[#description ][Description ]]
- [[#features ][Features: ]]
- [[#install ][Install ]]
- [[#lsp ][LSP ]]
- [[#options ][Options ]]
- [[#key-bindings ][Key bindings ]]
* Description
This layer adds support for [[https://julialang.org ][Julia ]] to Spacemacs.
** Features:
2018-09-19 03:54:47 +00:00
- Syntax highlighting
- Repl support
- Linting
- Completion
- Jump-to-definition
- Documentation on hover
2018-08-11 03:31:29 +00:00
* Install
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
add =julia= to the existing =dotspacemacs-configuration-layers= list in this
file.
** LSP
2018-10-19 15:57:15 +00:00
This layer can be used with [[https://github.com/JuliaEditorSupport/LanguageServer.jl ][=LanguageServer.jl= ]] and emacs [[https://github.com/emacs-lsp/lsp-mode ][=lsp-mode= ]] to provide
2018-08-11 03:31:29 +00:00
richer, IDE-like capabilities. To use this layer with lsp, you must do the
following:
2019-09-10 20:58:15 +00:00
1. =LanguageServer.jl= should be configured automatically, if not, see the documentation of =lsp-julia= .
2. Enable layer integration with lsp as described in section below.
2018-08-11 03:31:29 +00:00
=LanguageServer.jl= tends to have a very long startup time. In the worst case,
=lsp-mode= might give up on the language server before its started, but
regardless usage of =lsp-mode= with Julia can cause long delays when first
2019-09-08 09:52:04 +00:00
opening files.
2018-08-11 03:31:29 +00:00
* Options
While =julia-mode= is perfectly usable without configuration or other packages,
you can choose to replace the default functionality of using [[https://github.com/tpapp/julia-repl/ ][=julia-repl= ]] as the
2019-05-26 20:58:52 +00:00
layer's interactive REPL with the ess REPL and other functionality that comes
2018-08-11 03:31:29 +00:00
with it. To do so, install this layer with:
#+BEGIN_SRC emacs-lisp
(setq-default
dotspacemacs-configuration-layers
'(
(julia :variables julia-mode-enable-ess t)))
#+END_SRC
This layer also includes experimental support for =lsp-mode= . To enable language
server functionality with this layer, follow [[#lsp ][the instructions for installation ]],
and then install this layer with:
#+BEGIN_SRC emacs-lisp
(setq-default
dotspacemacs-configuration-layers
'(
(julia :variables julia-mode-enable-lsp t)))
#+END_SRC
2018-10-18 16:55:32 +00:00
Warning: [[https://github.com/JuliaEditorSupport/LanguageServer.jl ][=LanguageServer.jl= ]] has not yet been released for Julia 1.0. If you are
using this layer with Julia 1.0, =julia-mode-enable-lsp= should be set to =nil= .
2018-08-11 03:31:29 +00:00
* Key bindings
2019-09-08 09:52:04 +00:00
| Key binding | Description |
|-------------+----------------------------------------------------------------------------------------|
| ~TAB~ | Expands latex macro (e.g. =\delta=). |
| ~SPC m l~ | Expands latex macro (e.g. =\delta=). |
|-------------+----------------------------------------------------------------------------------------|
| ~SPC m = =~ | Indent line |
| ~SPC m = d~ | Deindent line |
| ~SPC m = q~ | Indent Sexp |
|-------------+----------------------------------------------------------------------------------------|
| ~SPC m '~ | Brings up Julia Repl (starts new one or focuses existing). |
| ~SPC m r~ | Brings up Julia Repl (starts new one or focuses existing). |
| ~SPC m h h~ | Calls ~@doc~ macro on symbol under cursor. |
|-------------+----------------------------------------------------------------------------------------|
| ~SPC m s a~ | Activate the project of the current buffer (call with prefix to activate home project) |
| ~SPC m s d~ | ~cd~ into the buffer directory |
| ~SPC m s i~ | Brings up Julia Repl (starts new one or focuses existing). |
| ~SPC m s b~ | Sends buffer to REPL. |
| ~SPC m s t~ | Sends buffer to REPL via ~Revise.includet~. |
| ~SPC m s l~ | Sends line to REPL. |
| ~SPC m s s~ | Sends line to REPL. |
| ~SPC m s r~ | Sends region or line to REPL. |
| ~SPC m s m~ | Call ~@macroexpand~ on an expression |
| ~SPC m s e~ | Call ~@edit~ on an expression |
| ~SPC m s v~ | Prompt and set a Julia REPL inferior buffer name for the current buffer |
|-------------+----------------------------------------------------------------------------------------|
| ~SPC m e a~ | Activate the project of the current buffer (call with prefix to activate home project) |
| ~SPC m e d~ | ~cd~ into the buffer directory |
| ~SPC m e i~ | Brings up Julia Repl (starts new one or focuses existing). |
| ~SPC m e b~ | Sends buffer to REPL. |
| ~SPC m e t~ | Sends buffer to REPL via ~Revise.includet~. |
| ~SPC m e l~ | Sends line to REPL. |
| ~SPC m e s~ | Sends line to REPL. |
| ~SPC m e r~ | Sends region or line to REPL. |
| ~SPC m e m~ | Call ~@macroexpand~ on an expression |
| ~SPC m e e~ | Call ~@edit~ on an expression |
| ~SPC m e v~ | Prompt and set a Julia REPL inferior buffer name for the current buffer |