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/packages.el

109 lines
3.5 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Julia layer packages file for Spacemacs.
2018-08-11 03:31:29 +00:00
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Adam Beckmeyer <adam_git@thebeckmeyers.xyz>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defconst julia-packages
'(
evil-surround
flycheck
julia-mode
julia-repl
lsp-julia
2018-08-11 03:31:29 +00:00
))
(defun julia/init-julia-mode ()
(use-package julia-mode
:defer t
:init
(progn
(add-hook 'julia-mode-hook #'spacemacs//julia-setup-buffer)
(add-hook 'julia-mode-local-vars-hook #'spacemacs//julia-setup-backend)
(if (and (configuration-layer/layer-used-p 'ess)
julia-mode-enable-ess)
(add-to-list 'auto-mode-alist
'("\\.jl\\'" . ess-julia-mode)))
(if (and (not (configuration-layer/layer-used-p 'ess))
julia-mode-enable-ess)
(message "`ess' layer is not installed. Please add `ess' layer to your dotfile.")))
:config
(progn
(spacemacs/declare-prefix-for-mode 'julia-mode "m=" "format")
(spacemacs/set-leader-keys-for-major-mode 'julia-mode
"l" 'julia-latexsub-or-indent
"==" 'julia-indent-line
"=d" 'julia-manual-deindent
"=q" 'prog-indent-sexp)
2019-09-08 09:52:04 +00:00
(when (configuration-layer/package-used-p 'helm)
(spacemacs/declare-prefix-for-mode 'julia-mode "mi" "insert")
(spacemacs/set-leader-keys-for-minor-mode 'julia-mode
"ii" 'spacemacs//julia-helm-math-insert)))))
2018-08-11 03:31:29 +00:00
(defun julia/init-julia-repl ()
(use-package julia-repl
:defer t
:init
(progn
(spacemacs/register-repl 'julia-repl 'julia-repl "julia-repl"))
:config
(progn
(spacemacs/declare-prefix-for-mode 'julia-mode "mh" "help")
(spacemacs/declare-prefix-for-mode 'julia-mode "me" "eval")
(spacemacs/declare-prefix-for-mode 'julia-mode "ms" "send")
(spacemacs/set-leader-keys-for-minor-mode 'julia-repl-mode
"'" 'julia-repl
"r" 'julia-repl
"hh" 'julia-repl-doc
2019-09-08 09:52:04 +00:00
"sa" 'julia-repl-activate-parent
"sd" 'julia-repl-cd
"si" 'julia-repl
"sb" 'julia-repl-send-buffer
"st" 'julia-repl-includet-buffer
"sl" 'julia-repl-send-line
"ss" 'julia-repl-send-line
"sr" 'julia-repl-send-region-or-line
"sm" 'julia-repl-macroexpand
"se" 'julia-repl-edit
"sv" 'julia-repl-prompt-set-inferior-buffer-name-suffix
2019-09-08 09:52:04 +00:00
"ea" 'julia-repl-activate-parent
"ed" 'julia-repl-cd
"eb" 'julia-repl-send-buffer
"et" 'julia-repl-includet-buffer
"el" 'julia-repl-send-line
"es" 'julia-repl-send-line
"er" 'julia-repl-send-region-or-line
"em" 'julia-repl-macroexpand
"ee" 'julia-repl-edit
"ev" 'julia-repl-prompt-set-inferior-buffer-name-suffix))))
2019-09-08 09:52:04 +00:00
2018-08-11 03:31:29 +00:00
(defun julia/post-init-evil-surround ()
(use-package evil-surround
:config
(progn
(add-hook
'julia-mode-hook
#'(lambda ()
(add-to-list 'evil-surround-pairs-alist '(?b . ("begin " . " end")))
(add-to-list 'evil-surround-pairs-alist '(?q . ("quote " . " end")))
(add-to-list 'evil-surround-pairs-alist '(?: . (":(" . ")")))
(add-to-list 'evil-surround-pairs-alist '(?l . ("let " . " end"))))))))
2018-08-11 03:31:29 +00:00
(defun julia/init-lsp-julia ()
(use-package lsp-julia
:config
(progn
(push 'xref-find-definitions spacemacs-jump-handlers-julia-mode))))
2018-08-11 03:31:29 +00:00
(defun julia/post-init-flycheck ()
(spacemacs/enable-flycheck 'julia-mode))