This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/julia/README.org

94 lines
3.7 KiB
Org Mode
Raw Normal View History

2018-08-11 03:31:29 +00:00
#+TITLE: julia layer
[[file:img/julia.png]]
2018-09-19 03:54:47 +00:00
* Table of Contents :TOC_4_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
Warning: enabling the LSP functionality within this package can cause emacs to
hang for significant lengths of time when opening a Julia file. See tip below on
using PackageCompiler.jl to mitigate this issue.
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:
1. Add =lsp= to =dotspacemacs-configuration-layers=.
2. Install =LanguageServer.jl= by invoking =Pkg.add("LanguageServer")= in the
Julia REPL.
2018-08-11 03:31:29 +00:00
3. Enable layer integration with lsp as described in section below.
=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
opening files. To mitigate this issue, you can try compiling =LanguageServer.jl=
ahead of time using [[https://github.com/JuliaLang/PackageCompiler.jl][=PackageCompiler.jl=]]. This drastically reduces startup time
if successful:
#+BEGIN_SRC julia
julia> Pkg.add("PackageCompiler")
julia> using PackageCompiler
julia> compile_package("LanguageServer")
#+END_SRC
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
2018-09-19 03:54:47 +00:00
layers 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
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
| Key binding | Description |
2018-08-11 03:31:29 +00:00
|-------------+------------------------------------------------------------|
| ~SPC m h h~ | Calls ~@doc~ macro on symbol under cursor. |
| ~SPC m e m~ | Expands macro under cursor. |
| ~SPC m w~ | Calls ~workspace()~ in Repl to give clean namespace. |
| ~SPC e l~ | Expands latex macro (e.g. =\delta=). |
| ~SPC m s b~ | Sends buffer to REPL. |
| ~SPC m s l~ | Sends line to REPL. |
| ~SPC m s r~ | Sends region to REPL. |
| ~SPC m r~ | Brings up Julia Repl (starts new one or focuses existing). |