Skip to content

Latest commit

 

History

History
93 lines (77 loc) · 3.7 KB

README.org

File metadata and controls

93 lines (77 loc) · 3.7 KB

julia layer

img/julia.png

Table of Contents

Description

This layer adds support for Julia to Spacemacs.

Features:

  • Syntax highlighting
  • Repl support
  • Linting
  • Completion
  • Jump-to-definition
  • Documentation on hover

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 =LanguageServer.jl= and emacs =lsp-mode= to provide 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.
  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 =PackageCompiler.jl=. This drastically reduces startup time if successful:

julia> Pkg.add("PackageCompiler")
julia> using PackageCompiler
julia> compile_package("LanguageServer")

Options

While julia-mode is perfectly usable without configuration or other packages, you can choose to replace the default functionality of using =julia-repl= as the layer’s interactive REPL with the ess REPL and other functionality that comes with it. To do so, install this layer with:

(setq-default
 dotspacemacs-configuration-layers
 '(
   (julia :variables julia-mode-enable-ess t)))

This layer also includes experimental support for lsp-mode. To enable language server functionality with this layer, follow the instructions for installation, and then install this layer with:

(setq-default
 dotspacemacs-configuration-layers
 '(
   (julia :variables julia-mode-enable-lsp t)))

Warning: =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.

Key bindings

Key bindingDescription
SPC m h hCalls @doc macro on symbol under cursor.
SPC m e mExpands macro under cursor.
SPC m wCalls workspace() in Repl to give clean namespace.
SPC e lExpands latex macro (e.g. \delta).
SPC m s bSends buffer to REPL.
SPC m s lSends line to REPL.
SPC m s rSends region to REPL.
SPC m rBrings up Julia Repl (starts new one or focuses existing).