2015-04-19 03:40:24 +00:00
|
|
|
(setq clojure-packages
|
2014-12-11 12:07:49 +00:00
|
|
|
'(
|
2015-04-06 03:13:00 +00:00
|
|
|
align-cljlet
|
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
|
|
|
|
company
|
2015-07-26 05:18:16 +00:00
|
|
|
popwin
|
2015-02-20 04:37:06 +00:00
|
|
|
rainbow-delimiters
|
|
|
|
subword
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2014-12-11 12:07:49 +00:00
|
|
|
|
2015-02-24 02:58:18 +00:00
|
|
|
(defun clojure/init-align-cljlet ()
|
|
|
|
(use-package align-cljlet
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(add-hook 'clojure-mode-hook (lambda () (require 'align-cljlet)))
|
|
|
|
:config
|
|
|
|
(evil-leader/set-key-for-mode 'clojure-mode
|
2015-02-24 03:18:48 +00:00
|
|
|
"mfl" 'align-cljlet)))
|
2015-02-24 02:58:18 +00:00
|
|
|
|
2014-12-11 12:07:49 +00:00
|
|
|
(defun clojure/init-cider ()
|
|
|
|
(use-package cider
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
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)
|
2015-02-24 01:52:49 +00:00
|
|
|
(add-hook 'clojure-mode-hook 'cider-mode)
|
2015-03-05 21:56:11 +00:00
|
|
|
(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
(add-hook 'cider-repl-mode-hook #'smartparens-strict-mode)))
|
2014-12-11 12:07:49 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-02-24 01:52:49 +00:00
|
|
|
;; add support for golden-ratio
|
2015-02-25 12:44:48 +00:00
|
|
|
(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
|
|
|
|
(push 'cider-stacktrace-mode evil-motion-state-modes)
|
|
|
|
(push 'cider-popup-buffer-mode evil-motion-state-modes)
|
2015-07-07 03:49:16 +00:00
|
|
|
|
2015-02-20 03:31:32 +00:00
|
|
|
(defun spacemacs//cider-eval-in-repl-no-focus (form)
|
|
|
|
"Insert FORM in the REPL buffer and eval it."
|
2015-08-14 09:41:00 +00:00
|
|
|
(while (string-match "\\`[ \t\n\r]+\\|[ \t\n\r]+\\'" form)
|
|
|
|
(setq form (replace-match "" t t form)))
|
|
|
|
(with-current-buffer (cider-current-repl-buffer)
|
|
|
|
(let ((pt-max (point-max)))
|
|
|
|
(goto-char pt-max)
|
2015-02-20 03:31:32 +00:00
|
|
|
(insert form)
|
2015-08-14 09:41:00 +00:00
|
|
|
(indent-region pt-max (point))
|
2015-02-20 03:31:32 +00:00
|
|
|
(cider-repl-return))))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-last-sexp-to-repl ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send last sexp to REPL and evaluate it without changing
|
|
|
|
the focus."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-last-sexp)))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-last-sexp-to-repl-focus ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send last sexp to REPL and evaluate it and switch to the REPL in
|
|
|
|
`insert state'."
|
|
|
|
(interactive)
|
|
|
|
(cider-insert-last-sexp-in-repl t)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-region-to-repl (start end)
|
2015-02-24 03:09:39 +00:00
|
|
|
"Send region to REPL and evaluate it without changing
|
|
|
|
the focus."
|
2015-02-27 23:19:23 +00:00
|
|
|
(interactive "r")
|
2015-02-24 03:09:39 +00:00
|
|
|
(spacemacs//cider-eval-in-repl-no-focus
|
2015-02-27 23:19:23 +00:00
|
|
|
(buffer-substring-no-properties start end)))
|
2015-02-24 03:09:39 +00:00
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-region-to-repl-focus (start end)
|
2015-02-24 03:09:39 +00:00
|
|
|
"Send region to REPL and evaluate it and switch to the REPL in
|
|
|
|
`insert state'."
|
2015-02-27 23:19:23 +00:00
|
|
|
(interactive "r")
|
2015-02-24 03:09:39 +00:00
|
|
|
(cider-insert-in-repl
|
2015-02-27 23:19:23 +00:00
|
|
|
(buffer-substring-no-properties start end) t)
|
2015-02-24 03:09:39 +00:00
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-function-to-repl ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send current function to REPL and evaluate it without changing
|
|
|
|
the focus."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-defun-at-point)))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-function-to-repl-focus ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send current function to REPL and evaluate it and switch to the REPL in
|
|
|
|
`insert state'."
|
|
|
|
(interactive)
|
|
|
|
(cider-insert-defun-in-repl t)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-ns-form-to-repl ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send buffer's ns form to REPL and evaluate it without changing
|
|
|
|
the focus."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-ns-form)))
|
|
|
|
|
2015-03-29 13:48:28 +00:00
|
|
|
(defun spacemacs/cider-send-ns-form-to-repl-focus ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send ns form to REPL and evaluate it and switch to the REPL in
|
|
|
|
`insert state'."
|
|
|
|
(interactive)
|
|
|
|
(cider-insert-ns-form-in-repl t)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-03-14 05:46:05 +00:00
|
|
|
(defun spacemacs/cider-send-buffer-in-repl-and-focus ()
|
2015-02-20 03:31:32 +00:00
|
|
|
"Send the current buffer in the REPL and switch to the REPL in
|
|
|
|
`insert state'."
|
|
|
|
(interactive)
|
|
|
|
(cider-load-buffer)
|
|
|
|
(cider-switch-to-repl-buffer)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-05-03 17:46:19 +00:00
|
|
|
(defun spacemacs/cider-test-run-focused-test ()
|
|
|
|
(interactive)
|
|
|
|
(cider-load-buffer)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-test-run-test)))
|
|
|
|
|
|
|
|
(defun spacemacs/cider-test-run-all-tests ()
|
|
|
|
(interactive)
|
|
|
|
(cider-load-buffer)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-test-run-tests nil)))
|
|
|
|
|
|
|
|
(defun spacemacs/cider-test-rerun-tests ()
|
|
|
|
(interactive)
|
|
|
|
(cider-load-buffer)
|
|
|
|
(spacemacs//cider-eval-in-repl-no-focus (cider-test-rerun-tests)))
|
|
|
|
|
2015-09-04 17:11:04 +00:00
|
|
|
(defun spacemacs/cider-display-error-buffer (&optional arg)
|
|
|
|
"Displays the *cider-error* buffer in the current window.
|
|
|
|
If called with a prefix argument, uses the other-window instead."
|
|
|
|
(interactive "P")
|
|
|
|
(let ((buffer (get-buffer cider-error-buffer)))
|
|
|
|
(when buffer
|
|
|
|
(funcall (if (equal arg '(4))
|
|
|
|
'switch-to-buffer-other-window
|
|
|
|
'switch-to-buffer)
|
|
|
|
buffer))))
|
|
|
|
|
2015-08-14 09:54:09 +00:00
|
|
|
(defun spacemacs/cider-toggle-repl-pretty-printing ()
|
|
|
|
(interactive)
|
|
|
|
(setq cider-repl-use-pretty-printing
|
|
|
|
(if cider-repl-use-pretty-printing nil t))
|
|
|
|
(message "Cider REPL pretty printing: %s"
|
|
|
|
(if cider-repl-use-pretty-printing "ON" "OFF")))
|
|
|
|
|
2015-08-14 09:55:01 +00:00
|
|
|
(defun spacemacs/cider-toggle-repl-font-locking ()
|
|
|
|
(interactive)
|
|
|
|
(setq cider-repl-use-clojure-font-lock
|
|
|
|
(if cider-repl-use-pretty-printing nil t))
|
|
|
|
(message "Cider REPL clojure-mode font-lock: %s"
|
|
|
|
(if cider-repl-use-clojure-font-lock "ON" "OFF")))
|
|
|
|
|
2015-08-18 12:39:25 +00:00
|
|
|
(defun spacemacs/cider-debug-setup ()
|
|
|
|
(when (eq dotspacemacs-editing-style 'vim)
|
|
|
|
(evil-make-overriding-map cider--debug-mode-map 'normal)
|
|
|
|
(evil-normalize-keymaps)))
|
|
|
|
|
|
|
|
(add-hook 'cider--debug-mode-hook 'spacemacs/cider-debug-setup)
|
|
|
|
|
2015-08-14 09:42:54 +00:00
|
|
|
(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
|
2015-08-25 01:07:59 +00:00
|
|
|
(kbd "a") 'cider-stacktrace-toggle-all
|
2015-08-14 09:42:54 +00:00
|
|
|
(kbd "c") 'cider-stacktrace-toggle-clj
|
2015-08-25 01:07:59 +00:00
|
|
|
(kbd "d") 'cider-stacktrace-toggle-duplicates
|
2015-08-14 09:42:54 +00:00
|
|
|
(kbd "J") 'cider-stacktrace-toggle-java
|
|
|
|
(kbd "r") 'cider-stacktrace-toggle-repl
|
2015-08-25 01:07:59 +00:00
|
|
|
(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-04-02 18:53:43 +00:00
|
|
|
(evilify cider-docview-mode cider-docview-mode-map
|
2015-04-13 19:29:46 +00:00
|
|
|
(kbd "q") 'cider-popup-buffer-quit)
|
2015-08-14 10:11:29 +00:00
|
|
|
|
2015-06-21 02:42:44 +00:00
|
|
|
(evilify cider-inspector-mode cider-inspector-mode-map
|
2015-08-16 09:12:04 +00:00
|
|
|
(kbd "L") 'cider-inspector-pop
|
|
|
|
(kbd "n") 'cider-inspector-next-page
|
2015-08-25 01:07:59 +00:00
|
|
|
(kbd "N") 'cider-inspector-previous-page
|
|
|
|
(kbd "r") 'cider-inspector-refresh)
|
2015-04-02 18:53:43 +00:00
|
|
|
|
2015-08-14 10:11:29 +00:00
|
|
|
(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
|
2015-08-25 01:07:59 +00:00
|
|
|
(kbd "q") 'cider-popup-buffer-quit
|
2015-08-14 10:11:29 +00:00
|
|
|
(kbd "r") 'cider-test-rerun-tests
|
|
|
|
(kbd "t") 'cider-test-run-test
|
|
|
|
(kbd "T") 'cider-test-run-tests)
|
|
|
|
|
|
|
|
;; TODO: having this work for cider-macroexpansion-mode would be nice,
|
|
|
|
;; but the problem is that it uses clojure-mode as its major-mode
|
|
|
|
|
2015-08-06 10:26:46 +00:00
|
|
|
(dolist (m '(clojure-mode clojurec-mode clojurescript-mode clojurex-mode))
|
|
|
|
(evil-leader/set-key-for-mode m
|
|
|
|
"mhh" 'cider-doc
|
|
|
|
"mhg" 'cider-grimoire
|
|
|
|
"mhj" 'cider-javadoc
|
2015-02-20 03:31:32 +00:00
|
|
|
|
2015-08-06 10:26:46 +00:00
|
|
|
"meb" 'cider-eval-buffer
|
|
|
|
"mee" 'cider-eval-last-sexp
|
|
|
|
"mef" 'cider-eval-defun-at-point
|
|
|
|
"mer" 'cider-eval-region
|
|
|
|
"mew" 'cider-eval-last-sexp-and-replace
|
2015-02-20 03:31:32 +00:00
|
|
|
|
2015-08-06 10:26:46 +00:00
|
|
|
"mgb" 'cider-jump-back
|
|
|
|
"mge" 'cider-jump-to-compilation-error
|
2015-09-04 17:11:04 +00:00
|
|
|
"mgg" 'cider-find-var
|
2015-08-06 10:26:46 +00:00
|
|
|
"mgr" 'cider-jump-to-resource
|
2015-02-20 03:31:32 +00:00
|
|
|
|
2015-08-06 10:26:46 +00:00
|
|
|
"msb" 'cider-load-buffer
|
|
|
|
"msB" 'spacemacs/cider-send-buffer-in-repl-and-focus
|
|
|
|
"msc" 'cider-connect
|
|
|
|
"mse" 'spacemacs/cider-send-last-sexp-to-repl
|
|
|
|
"msE" 'spacemacs/cider-send-last-sexp-to-repl-focus
|
|
|
|
"msf" 'spacemacs/cider-send-function-to-repl
|
|
|
|
"msF" 'spacemacs/cider-send-function-to-repl-focus
|
|
|
|
"msi" 'cider-jack-in
|
|
|
|
"msn" 'spacemacs/cider-send-ns-form-to-repl
|
|
|
|
"msN" 'spacemacs/cider-send-ns-form-to-repl-focus
|
|
|
|
"msq" 'cider-quit
|
|
|
|
"msr" 'spacemacs/cider-send-region-to-repl
|
|
|
|
"msR" 'spacemacs/cider-send-region-to-repl-focus
|
|
|
|
"mss" 'cider-switch-to-repl-buffer
|
2015-09-03 12:26:44 +00:00
|
|
|
"msx" 'cider-refresh
|
2015-08-25 01:01:35 +00:00
|
|
|
|
|
|
|
"mTf" 'spacemacs/cider-toggle-repl-font-locking
|
2015-08-25 01:07:59 +00:00
|
|
|
"mTp" 'spacemacs/cider-toggle-repl-pretty-printing
|
2015-02-20 03:31:32 +00:00
|
|
|
|
2015-08-06 10:26:46 +00:00
|
|
|
"mta" 'spacemacs/cider-test-run-all-tests
|
|
|
|
"mtr" 'spacemacs/cider-test-rerun-tests
|
|
|
|
"mtt" 'spacemacs/cider-test-run-focused-test
|
2015-06-21 02:42:44 +00:00
|
|
|
|
2015-08-25 01:07:59 +00:00
|
|
|
"mdb" 'cider-debug-defun-at-point
|
2015-09-04 17:11:04 +00:00
|
|
|
"mde" 'spacemacs/cider-display-error-buffer
|
2015-08-25 01:07:59 +00:00
|
|
|
"mdi" 'cider-inspect))
|
2015-08-14 09:55:28 +00:00
|
|
|
|
|
|
|
(evil-leader/set-key-for-mode 'cider-repl-mode
|
|
|
|
"mhh" 'cider-doc
|
|
|
|
"mhg" 'cider-grimoire
|
|
|
|
"mhj" 'cider-javadoc
|
|
|
|
|
|
|
|
"mee" 'cider-eval-last-sexp
|
|
|
|
"mef" 'cider-eval-defun-at-point
|
|
|
|
"mer" 'cider-eval-region
|
|
|
|
"mew" 'cider-eval-last-sexp-and-replace
|
|
|
|
|
|
|
|
"mgb" 'cider-jump-back
|
|
|
|
"mge" 'cider-jump-to-compilation-error
|
2015-09-04 17:11:04 +00:00
|
|
|
"mgg" 'cider-find-var
|
2015-08-14 09:55:28 +00:00
|
|
|
"mgr" 'cider-jump-to-resource
|
|
|
|
|
2015-08-25 01:07:59 +00:00
|
|
|
"msc" 'cider-repl-clear-buffer
|
2015-08-14 09:55:28 +00:00
|
|
|
"msn" 'cider-repl-set-ns
|
|
|
|
"msq" 'cider-quit
|
|
|
|
"mss" 'cider-switch-to-last-clojure-buffer
|
2015-09-03 12:26:44 +00:00
|
|
|
"msx" 'cider-refresh
|
2015-08-25 01:01:35 +00:00
|
|
|
|
|
|
|
"mTf" 'spacemacs/cider-toggle-repl-font-locking
|
2015-08-25 01:07:59 +00:00
|
|
|
"mTp" 'spacemacs/cider-toggle-repl-pretty-printing
|
2015-08-14 09:55:28 +00:00
|
|
|
|
2015-09-04 17:11:04 +00:00
|
|
|
"mde" 'spacemacs/cider-display-error-buffer
|
2015-08-25 01:07:59 +00:00
|
|
|
"mdi" 'cider-inspect)
|
2015-08-14 09:55:28 +00:00
|
|
|
|
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)))
|
|
|
|
|
2015-05-10 05:32:13 +00:00
|
|
|
(when (configuration-layer/package-usedp 'evil-jumper)
|
|
|
|
(defadvice cider-jump-to-var (before add-evil-jump activate)
|
2015-04-29 11:11:22 +00:00
|
|
|
(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 ()
|
|
|
|
(eval-after-load 'eval-sexp-fu
|
|
|
|
'(require 'cider-eval-sexp-fu)))
|
|
|
|
|
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")
|
|
|
|
|
|
|
|
(dolist (m '(clojure-mode clojurec-mode clojurescript-mode clojurex-mode))
|
|
|
|
(evil-leader/set-key-for-mode m
|
2015-08-25 01:07:59 +00:00
|
|
|
"mr?" 'cljr-describe-refactoring
|
2015-08-14 09:47:46 +00:00
|
|
|
"mrad" 'cljr-add-declaration
|
|
|
|
"mrai" 'cljr-add-import-to-ns
|
|
|
|
"mram" 'cljr-add-missing-libspec
|
|
|
|
"mrap" 'cljr-add-project-dependency
|
|
|
|
"mrar" 'cljr-add-require-to-ns
|
|
|
|
"mras" 'cljr-add-stubs
|
|
|
|
"mrau" 'cljr-add-use-to-ns
|
|
|
|
"mrcc" 'cljr-cycle-coll
|
|
|
|
"mrci" 'cljr-cycle-if
|
|
|
|
"mrcn" 'cljr-clean-ns
|
|
|
|
"mrcp" 'cljr-cycle-privacy
|
|
|
|
"mrdk" 'cljr-destructure-keys
|
|
|
|
"mref" 'cljr-extract-function
|
|
|
|
"mrec" 'cljr-extract-constant
|
|
|
|
"mrel" 'cljr-expand-let
|
|
|
|
"mrfu" 'cljr-find-usages
|
|
|
|
"mrfe" 'cljr-create-fn-from-example
|
|
|
|
"mrhd" 'cljr-hotload-dependency
|
|
|
|
"mril" 'cljr-introduce-let
|
|
|
|
"mris" 'cljr-inline-symbol
|
|
|
|
"mrmf" 'cljr-move-form
|
|
|
|
"mrml" 'cljr-move-to-let
|
|
|
|
"mrpc" 'cljr-project-clean
|
|
|
|
"mrpf" 'cljr-promote-function
|
|
|
|
"mrrd" 'cljr-remove-debug-fns
|
2015-08-25 11:08:17 +00:00
|
|
|
"mrrf" 'cljr-rename-file-or-dir
|
2015-08-14 09:47:46 +00:00
|
|
|
"mrrl" 'cljr-remove-let
|
|
|
|
"mrrr" 'cljr-remove-unused-requires
|
|
|
|
"mrrs" 'cljr-rename-symbol
|
|
|
|
"mrru" 'cljr-replace-use
|
|
|
|
"mrsn" 'cljr-sort-ns
|
|
|
|
"mrsp" 'cljr-sort-project-dependencies
|
|
|
|
"mrsr" 'cljr-stop-referring
|
|
|
|
"mrsc" 'cljr-show-changelog
|
|
|
|
"mrtf" 'cljr-thread-first-all
|
|
|
|
"mrth" 'cljr-thread
|
|
|
|
"mrtl" 'cljr-thread-last-all
|
|
|
|
"mrua" 'cljr-unwind-all
|
|
|
|
"mrup" 'cljr-update-project-dependencies
|
2015-08-25 01:07:59 +00:00
|
|
|
"mruw" 'cljr-unwind))
|
2015-08-14 09:57:24 +00:00
|
|
|
|
|
|
|
(evil-leader/set-key-for-mode 'cider-repl-mode
|
2015-08-25 01:07:59 +00:00
|
|
|
"mr?" 'cljr-describe-refactoring
|
2015-08-14 09:57:24 +00:00
|
|
|
"mrap" 'cljr-add-project-dependency
|
|
|
|
"mras" 'cljr-add-stubs
|
|
|
|
"mrcc" 'cljr-cycle-coll
|
|
|
|
"mrci" 'cljr-cycle-if
|
|
|
|
"mrcp" 'cljr-cycle-privacy
|
|
|
|
"mrdk" 'cljr-destructure-keys
|
|
|
|
"mrel" 'cljr-expand-let
|
|
|
|
"mrfu" 'cljr-find-usages
|
|
|
|
"mrhd" 'cljr-hotload-dependency
|
|
|
|
"mril" 'cljr-introduce-let
|
|
|
|
"mrml" 'cljr-move-to-let
|
|
|
|
"mrpc" 'cljr-project-clean
|
|
|
|
"mrrl" 'cljr-remove-let
|
|
|
|
"mrsp" 'cljr-sort-project-dependencies
|
|
|
|
"mrsc" 'cljr-show-changelog
|
|
|
|
"mrtf" 'cljr-thread-first-all
|
|
|
|
"mrth" 'cljr-thread
|
|
|
|
"mrtl" 'cljr-thread-last-all
|
|
|
|
"mrua" 'cljr-unwind-all
|
|
|
|
"mrup" 'cljr-update-project-dependencies
|
2015-08-25 01:07:59 +00:00
|
|
|
"mruw" 'cljr-unwind))))
|
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))
|
|
|
|
(add-to-list 'magic-mode-alist '(".* boot" . clojure-mode)))
|
2015-02-20 04:41:20 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-09-04 17:11:04 +00:00
|
|
|
|
|
|
|
(defun spacemacs/clojure-mode-toggle-default-indent-style ()
|
|
|
|
(interactive)
|
|
|
|
(setq clojure-defun-style-default-indent
|
|
|
|
(if clojure-defun-style-default-indent nil t))
|
|
|
|
(message "Clojure-mode default indent style: %s"
|
|
|
|
(if clojure-defun-style-default-indent "ON" "OFF")))
|
|
|
|
|
|
|
|
(dolist (m '(clojure-mode clojurec-mode clojurescript-mode clojurex-mode))
|
|
|
|
(evil-leader/set-key-for-mode m
|
|
|
|
"mTi" 'spacemacs/clojure-mode-toggle-default-indent-style))
|
|
|
|
|
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))
|
|
|
|
(clojure/fancify-symbols m)))
|
2015-07-10 09:59:55 +00:00
|
|
|
|
|
|
|
(define-clojure-indent
|
|
|
|
;; Compojure
|
|
|
|
(ANY 2)
|
|
|
|
(DELETE 2)
|
|
|
|
(GET 2)
|
|
|
|
(HEAD 2)
|
|
|
|
(POST 2)
|
|
|
|
(PUT 2)
|
|
|
|
(context 2)
|
|
|
|
(defroutes 'defun)
|
|
|
|
;; Cucumber
|
|
|
|
(After 1)
|
|
|
|
(Before 1)
|
|
|
|
(Given 2)
|
|
|
|
(Then 2)
|
|
|
|
(When 2)
|
|
|
|
;; Schema
|
|
|
|
(s/defrecord 2)
|
|
|
|
;; test.check
|
|
|
|
(for-all 'defun)))))
|
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)))
|
|
|
|
|
2015-08-09 03:35:16 +00:00
|
|
|
(defun clojure/post-init-rainbow-delimiters ()
|
2015-04-03 23:13:52 +00:00
|
|
|
(if (configuration-layer/package-usedp 'cider)
|
2015-02-20 05:14:12 +00:00
|
|
|
(add-hook 'cider-mode-hook 'rainbow-delimiters-mode)))
|
2015-02-20 04:37:06 +00:00
|
|
|
|
2015-08-09 03:35:16 +00:00
|
|
|
(defun clojure/post-init-subword ()
|
2015-02-20 04:37:06 +00:00
|
|
|
(unless (version< emacs-version "24.4")
|
|
|
|
(add-hook 'cider-mode-hook 'subword-mode)))
|
2015-04-03 22:33:37 +00:00
|
|
|
|
2015-04-03 23:13:52 +00:00
|
|
|
(when (configuration-layer/layer-usedp 'auto-completion)
|
2015-04-06 03:13:00 +00:00
|
|
|
(defun clojure/post-init-company ()
|
|
|
|
(push 'company-capf company-backends-cider-mode)
|
2015-04-09 03:57:22 +00:00
|
|
|
(spacemacs|add-company-hook cider-mode)
|
|
|
|
|
2015-04-06 03:13:00 +00:00
|
|
|
(push 'company-capf company-backends-cider-repl-mode)
|
2015-04-09 03:57:22 +00:00
|
|
|
(spacemacs|add-company-hook cider-repl-mode)))
|