2015-04-19 03:40:24 +00:00
|
|
|
(setq clojure-packages
|
2014-12-11 12:07:49 +00:00
|
|
|
'(
|
|
|
|
cider
|
2015-04-05 03:25:11 +00:00
|
|
|
cider-eval-sexp-fu
|
2014-12-11 12:07:49 +00:00
|
|
|
clj-refactor
|
2015-04-06 03:13:00 +00:00
|
|
|
clojure-mode
|
2016-02-28 08:28:12 +00:00
|
|
|
(clojure-snippets :toggle (configuration-layer/layer-usedp 'auto-completion))
|
2015-04-06 03:13:00 +00:00
|
|
|
company
|
2016-04-11 18:30:47 +00:00
|
|
|
eldoc
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
|
|
|
helm-gtags
|
2015-07-26 05:18:16 +00:00
|
|
|
popwin
|
2016-06-11 16:41:20 +00:00
|
|
|
smartparens
|
2015-02-20 04:37:06 +00:00
|
|
|
subword
|
2016-02-28 08:28:12 +00:00
|
|
|
))
|
2014-12-11 12:07:49 +00:00
|
|
|
|
|
|
|
(defun clojure/init-cider ()
|
|
|
|
(use-package cider
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
2016-01-26 16:31:15 +00:00
|
|
|
(spacemacs/register-repl 'cider 'cider-jack-in "cider")
|
2014-12-17 05:58:14 +00:00
|
|
|
(setq cider-stacktrace-default-filters '(tooling dup)
|
|
|
|
cider-repl-pop-to-buffer-on-connect nil
|
2015-02-02 23:07:29 +00:00
|
|
|
cider-prompt-save-file-on-load nil
|
|
|
|
cider-repl-use-clojure-font-lock t)
|
2015-04-13 19:29:46 +00:00
|
|
|
(push "\\*cider-repl\.\+\\*" spacemacs-useful-buffers-regexp)
|
2016-08-13 13:43:37 +00:00
|
|
|
(add-hook 'clojure-mode-hook 'cider-mode)
|
2016-09-04 16:24:43 +00:00
|
|
|
(dolist (x '(spacemacs-jump-handlers-clojure-mode
|
|
|
|
spacemacs-jump-handlers-clojurec-mode
|
|
|
|
spacemacs-jump-handlers-clojurescript-mode
|
|
|
|
spacemacs-jump-handlers-clojurex-mode
|
|
|
|
spacemacs-jump-handlers-cider-repl-mode))
|
|
|
|
(add-to-list x 'cider-find-var)))
|
2014-12-11 12:07:49 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-02-24 01:52:49 +00:00
|
|
|
;; add support for golden-ratio
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'golden-ratio
|
|
|
|
(push 'cider-popup-buffer-quit-function golden-ratio-extra-commands))
|
2015-02-24 01:52:49 +00:00
|
|
|
;; add support for evil
|
2015-12-15 21:36:18 +00:00
|
|
|
(evil-set-initial-state 'cider-stacktrace-mode 'motion)
|
|
|
|
(evil-set-initial-state 'cider-popup-buffer-mode 'motion)
|
2015-08-18 12:39:25 +00:00
|
|
|
(add-hook 'cider--debug-mode-hook 'spacemacs/cider-debug-setup)
|
|
|
|
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify cider-stacktrace-mode cider-stacktrace-mode-map
|
|
|
|
(kbd "C-j") 'cider-stacktrace-next-cause
|
|
|
|
(kbd "C-k") 'cider-stacktrace-previous-cause
|
|
|
|
(kbd "TAB") 'cider-stacktrace-cycle-current-cause
|
|
|
|
(kbd "0") 'cider-stacktrace-cycle-all-causes
|
|
|
|
(kbd "1") 'cider-stacktrace-cycle-cause-1
|
|
|
|
(kbd "2") 'cider-stacktrace-cycle-cause-2
|
|
|
|
(kbd "3") 'cider-stacktrace-cycle-cause-3
|
|
|
|
(kbd "4") 'cider-stacktrace-cycle-cause-4
|
|
|
|
(kbd "5") 'cider-stacktrace-cycle-cause-5
|
|
|
|
(kbd "a") 'cider-stacktrace-toggle-all
|
|
|
|
(kbd "c") 'cider-stacktrace-toggle-clj
|
|
|
|
(kbd "d") 'cider-stacktrace-toggle-duplicates
|
|
|
|
(kbd "J") 'cider-stacktrace-toggle-java
|
|
|
|
(kbd "r") 'cider-stacktrace-toggle-repl
|
|
|
|
(kbd "T") 'cider-stacktrace-toggle-tooling)
|
2015-03-24 14:32:33 +00:00
|
|
|
|
2015-04-02 18:53:43 +00:00
|
|
|
;; open cider-doc directly and close it with q
|
|
|
|
(setq cider-prompt-for-symbol nil)
|
2015-08-14 10:11:29 +00:00
|
|
|
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify cider-docview-mode cider-docview-mode-map
|
|
|
|
(kbd "q") 'cider-popup-buffer-quit)
|
|
|
|
|
|
|
|
(evilified-state-evilify cider-inspector-mode cider-inspector-mode-map
|
|
|
|
(kbd "L") 'cider-inspector-pop
|
|
|
|
(kbd "n") 'cider-inspector-next-page
|
|
|
|
(kbd "N") 'cider-inspector-previous-page
|
|
|
|
(kbd "r") 'cider-inspector-refresh)
|
|
|
|
|
|
|
|
(evilified-state-evilify cider-test-report-mode cider-test-report-mode-map
|
|
|
|
(kbd "C-j") 'cider-test-next-result
|
|
|
|
(kbd "C-k") 'cider-test-previous-result
|
|
|
|
(kbd "RET") 'cider-test-jump
|
|
|
|
(kbd "d") 'cider-test-ediff
|
|
|
|
(kbd "e") 'cider-test-stacktrace
|
|
|
|
(kbd "q") 'cider-popup-buffer-quit
|
|
|
|
(kbd "r") 'cider-test-rerun-tests
|
|
|
|
(kbd "t") 'cider-test-run-test
|
2016-02-15 11:10:50 +00:00
|
|
|
(kbd "T") 'cider-test-run-ns-tests)
|
2015-08-14 10:11:29 +00:00
|
|
|
|
|
|
|
;; TODO: having this work for cider-macroexpansion-mode would be nice,
|
|
|
|
;; but the problem is that it uses clojure-mode as its major-mode
|
|
|
|
|
2016-04-03 04:27:44 +00:00
|
|
|
(setq cider--key-binding-prefixes
|
|
|
|
'(("md" . "debug")
|
|
|
|
("me" . "evaluation")
|
|
|
|
("mg" . "goto")
|
|
|
|
("mh" . "documentation")
|
|
|
|
("ms" . "repl")
|
|
|
|
("mt" . "test")
|
|
|
|
("mT" . "toggle")
|
|
|
|
("mf" . "format")))
|
|
|
|
(dolist (m '(clojure-mode
|
|
|
|
clojurec-mode
|
|
|
|
clojurescript-mode
|
|
|
|
clojurex-mode
|
|
|
|
cider-repl-mode))
|
|
|
|
(mapc (lambda (x) (spacemacs/declare-prefix-for-mode
|
2016-04-04 06:14:25 +00:00
|
|
|
m (car x) (cdr x)))
|
2016-04-03 04:27:44 +00:00
|
|
|
cider--key-binding-prefixes)
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode m
|
2016-02-22 13:38:38 +00:00
|
|
|
"ha" 'cider-apropos
|
2015-11-18 00:38:05 +00:00
|
|
|
"hh" 'cider-doc
|
|
|
|
"hg" 'cider-grimoire
|
|
|
|
"hj" 'cider-javadoc
|
|
|
|
|
|
|
|
"eb" 'cider-eval-buffer
|
|
|
|
"ee" 'cider-eval-last-sexp
|
|
|
|
"ef" 'cider-eval-defun-at-point
|
|
|
|
"er" 'cider-eval-region
|
|
|
|
"ew" 'cider-eval-last-sexp-and-replace
|
|
|
|
|
|
|
|
"fb" 'cider-format-buffer
|
|
|
|
|
2016-03-04 04:54:54 +00:00
|
|
|
"gb" 'cider-pop-back
|
2016-08-17 19:50:24 +00:00
|
|
|
"gC" 'cider-classpath
|
2015-11-18 00:38:05 +00:00
|
|
|
"ge" 'cider-jump-to-compilation-error
|
|
|
|
"gr" 'cider-jump-to-resource
|
2016-08-17 19:50:24 +00:00
|
|
|
"gn" 'cider-browse-ns
|
|
|
|
"gN" 'cider-browse-ns-all
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2016-01-26 16:31:15 +00:00
|
|
|
"'" 'cider-jack-in
|
2015-11-18 00:38:05 +00:00
|
|
|
"sb" 'cider-load-buffer
|
|
|
|
"sB" 'spacemacs/cider-send-buffer-in-repl-and-focus
|
|
|
|
"sc" 'cider-connect
|
|
|
|
"se" 'spacemacs/cider-send-last-sexp-to-repl
|
|
|
|
"sE" 'spacemacs/cider-send-last-sexp-to-repl-focus
|
|
|
|
"sf" 'spacemacs/cider-send-function-to-repl
|
|
|
|
"sF" 'spacemacs/cider-send-function-to-repl-focus
|
|
|
|
"si" 'cider-jack-in
|
|
|
|
"sI" 'cider-jack-in-clojurescript
|
2016-09-20 08:09:26 +00:00
|
|
|
"sk" 'cider-find-and-clear-repl-output
|
2015-11-18 00:38:05 +00:00
|
|
|
"sn" 'spacemacs/cider-send-ns-form-to-repl
|
|
|
|
"sN" 'spacemacs/cider-send-ns-form-to-repl-focus
|
2016-02-19 18:30:32 +00:00
|
|
|
"so" 'cider-repl-switch-to-other
|
2015-11-18 00:38:05 +00:00
|
|
|
"sq" 'cider-quit
|
|
|
|
"sr" 'spacemacs/cider-send-region-to-repl
|
|
|
|
"sR" 'spacemacs/cider-send-region-to-repl-focus
|
|
|
|
"ss" 'cider-switch-to-repl-buffer
|
|
|
|
"sx" 'cider-refresh
|
|
|
|
|
2016-08-17 19:50:24 +00:00
|
|
|
"Te" 'cider-enlighten-mode
|
2015-11-18 00:38:05 +00:00
|
|
|
"Tf" 'spacemacs/cider-toggle-repl-font-locking
|
|
|
|
"Tp" 'spacemacs/cider-toggle-repl-pretty-printing
|
2016-08-17 19:50:24 +00:00
|
|
|
"Tt" 'cider-auto-test-mode
|
2015-11-18 00:38:05 +00:00
|
|
|
|
|
|
|
"ta" 'spacemacs/cider-test-run-all-tests
|
2016-04-16 17:40:22 +00:00
|
|
|
"tb" 'cider-test-show-report
|
|
|
|
"tl" 'spacemacs/cider-test-run-loaded-tests
|
|
|
|
"tp" 'spacemacs/cider-test-run-project-tests
|
|
|
|
"tn" 'spacemacs/cider-test-run-ns-tests
|
2015-11-18 00:38:05 +00:00
|
|
|
"tr" 'spacemacs/cider-test-rerun-tests
|
|
|
|
"tt" 'spacemacs/cider-test-run-focused-test
|
|
|
|
|
|
|
|
"db" 'cider-debug-defun-at-point
|
|
|
|
"de" 'spacemacs/cider-display-error-buffer
|
|
|
|
"di" 'cider-inspect))
|
|
|
|
|
2015-08-14 09:58:45 +00:00
|
|
|
(evil-define-key 'normal cider-repl-mode-map
|
|
|
|
"C-j" 'cider-repl-next-input
|
|
|
|
"C-k" 'cider-repl-previous-input)
|
|
|
|
|
2015-03-05 21:56:11 +00:00
|
|
|
(when clojure-enable-fancify-symbols
|
2015-04-29 11:11:22 +00:00
|
|
|
(clojure/fancify-symbols 'cider-repl-mode)))
|
|
|
|
|
2016-02-15 19:15:29 +00:00
|
|
|
(defadvice cider-jump-to-var (before add-evil-jump activate)
|
|
|
|
(evil-set-jump))))
|
2014-12-11 12:07:49 +00:00
|
|
|
|
2015-04-05 03:25:11 +00:00
|
|
|
(defun clojure/init-cider-eval-sexp-fu ()
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'eval-sexp-fu
|
|
|
|
(require 'cider-eval-sexp-fu)))
|
2015-04-05 03:25:11 +00:00
|
|
|
|
2014-12-11 12:07:49 +00:00
|
|
|
(defun clojure/init-clj-refactor ()
|
2015-08-14 09:57:24 +00:00
|
|
|
(use-package clj-refactor
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(add-hook 'clojure-mode-hook 'clj-refactor-mode)
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(cljr-add-keybindings-with-prefix "C-c C-f")
|
|
|
|
|
2016-04-03 04:27:44 +00:00
|
|
|
(setq clj-refactor--key-binding-prefixes
|
|
|
|
'(("mr" . "refactor")
|
|
|
|
("mra" . "add")
|
|
|
|
("mrc" . "cycle/clean")
|
|
|
|
("mrd" . "destructure")
|
|
|
|
("mre" . "extract/expand")
|
|
|
|
("mrf" . "find/function")
|
|
|
|
("mrh" . "hotload")
|
|
|
|
("mri" . "introduce/inline")
|
|
|
|
("mrm" . "move")
|
|
|
|
("mrp" . "project/promote")
|
|
|
|
("mrr" . "remove/rename/replace")
|
|
|
|
("mrs" . "show/sort/stop")
|
|
|
|
("mrt" . "thread")
|
|
|
|
("mru" . "unwind/update")))
|
|
|
|
(dolist (m '(clojure-mode
|
|
|
|
clojurec-mode
|
|
|
|
clojurescript-mode
|
|
|
|
clojurex-mode
|
|
|
|
cider-repl-mode))
|
|
|
|
(mapc (lambda (x) (spacemacs/declare-prefix-for-mode
|
2016-04-04 06:14:25 +00:00
|
|
|
m (car x) (cdr x)))
|
2016-04-03 04:27:44 +00:00
|
|
|
clj-refactor--key-binding-prefixes)
|
2015-11-26 15:36:21 +00:00
|
|
|
(dolist (r cljr--all-helpers)
|
|
|
|
(let* ((binding (car r))
|
|
|
|
(func (car (cdr r))))
|
|
|
|
(when (not (string-prefix-p "hydra" (symbol-name func)))
|
2016-04-03 04:27:44 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode m
|
|
|
|
(concat "r" binding) func))))))))
|
2015-02-20 04:37:06 +00:00
|
|
|
|
2015-02-20 04:41:20 +00:00
|
|
|
(defun clojure/init-clojure-mode ()
|
|
|
|
(use-package clojure-mode
|
|
|
|
:defer t
|
2015-07-07 14:15:46 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.boot\\'" . clojure-mode))
|
2016-05-05 21:38:13 +00:00
|
|
|
;; This regexp matches shebang expressions like `#!/usr/bin/env boot'
|
2016-09-05 02:29:41 +00:00
|
|
|
(add-to-list 'magic-mode-alist '("#!.*boot\\s-*$" . clojure-mode)))
|
2015-02-20 04:41:20 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-09-04 17:11:04 +00:00
|
|
|
(dolist (m '(clojure-mode clojurec-mode clojurescript-mode clojurex-mode))
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode m
|
2016-01-28 21:30:47 +00:00
|
|
|
"fl" 'clojure-align))
|
2015-09-04 17:11:04 +00:00
|
|
|
|
2015-02-20 04:41:20 +00:00
|
|
|
(when clojure-enable-fancify-symbols
|
2015-08-11 09:35:10 +00:00
|
|
|
(dolist (m '(clojure-mode clojurescript-mode clojurec-mode clojurex-mode))
|
2016-01-14 13:25:09 +00:00
|
|
|
(clojure/fancify-symbols m))))))
|
2015-07-26 05:18:16 +00:00
|
|
|
|
2016-04-11 18:30:47 +00:00
|
|
|
(defun clojure/post-init-eldoc ()
|
|
|
|
(add-hook 'cider-mode-hook 'eldoc-mode)
|
|
|
|
(add-hook 'cider-repl-mode-hook 'eldoc-mode))
|
|
|
|
|
2015-07-26 05:18:16 +00:00
|
|
|
(defun clojure/pre-init-popwin ()
|
|
|
|
(spacemacs|use-package-add-hook popwin
|
|
|
|
:post-config
|
|
|
|
(push '("*cider-error*" :dedicated t :position bottom :stick t :noselect nil :height 0.4)
|
2015-07-26 05:22:13 +00:00
|
|
|
popwin:special-display-config)
|
|
|
|
(push '("*cider-doc*" :dedicated t :position bottom :stick t :noselect nil :height 0.4)
|
2015-07-26 05:18:16 +00:00
|
|
|
popwin:special-display-config)))
|
|
|
|
|
2016-06-11 16:41:20 +00:00
|
|
|
(defun clojure/post-init-smartparens ()
|
|
|
|
(add-hook 'cider-repl-mode-hook
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
#'smartparens-strict-mode
|
|
|
|
#'smartparens-mode)))
|
|
|
|
|
2015-08-09 03:35:16 +00:00
|
|
|
(defun clojure/post-init-subword ()
|
2016-03-15 03:17:09 +00:00
|
|
|
(add-hook 'cider-mode-hook 'subword-mode))
|
2015-04-03 22:33:37 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun clojure/post-init-company ()
|
|
|
|
(push 'company-capf company-backends-cider-mode)
|
|
|
|
(spacemacs|add-company-hook cider-mode)
|
|
|
|
(push 'company-capf company-backends-cider-repl-mode)
|
|
|
|
(spacemacs|add-company-hook cider-repl-mode))
|
2016-02-28 08:28:12 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun clojure/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'clojure-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
|
|
|
(defun clojure/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'clojure-mode))
|
|
|
|
|
2016-02-28 08:28:12 +00:00
|
|
|
(defun clojure/init-clojure-snippets ()
|
|
|
|
(use-package clojure-snippets
|
|
|
|
:defer t))
|