2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/clojure/config.el -*- lexical-binding: t; -*-
|
2017-05-30 09:28:38 +02:00
|
|
|
|
2018-05-25 00:46:11 +02:00
|
|
|
;; `clojure-mode'
|
2018-08-19 01:12:24 +02:00
|
|
|
(after! clojure-mode
|
|
|
|
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
|
2017-05-30 09:28:38 +02:00
|
|
|
|
2018-10-15 23:08:59 -04:00
|
|
|
(set-popup-rules!
|
|
|
|
'(("^\\*cider-error*" :ignore t)
|
2018-11-13 21:29:16 -05:00
|
|
|
("^\\*cider-repl" :quit nil)
|
2018-10-15 23:08:59 -04:00
|
|
|
("^\\*cider-repl-history" :vslot 2 :ttl nil)))
|
|
|
|
|
2018-08-19 01:12:24 +02:00
|
|
|
(def-package! cider
|
|
|
|
;; NOTE: if you don't have an org directory set (the dir doesn't exist),
|
|
|
|
;; cider jack in won't work.
|
|
|
|
:commands (cider-jack-in cider-jack-in-clojurescript)
|
|
|
|
:hook (clojure-mode . cider-mode)
|
|
|
|
:init
|
|
|
|
(set-repl-handler! 'clojure-mode #'+clojure/repl)
|
|
|
|
(set-eval-handler! 'clojure-mode #'cider-eval-region)
|
|
|
|
(set-lookup-handlers! 'clojure-mode
|
|
|
|
:definition #'cider-browse-ns-find-at-point
|
|
|
|
:documentation #'cider-browse-ns-doc-at-point)
|
2018-10-15 00:08:48 -04:00
|
|
|
(add-hook 'cider-mode-hook #'eldoc-mode)
|
2018-08-19 01:12:24 +02:00
|
|
|
:config
|
2018-10-15 23:08:59 -04:00
|
|
|
(setq nrepl-hide-special-buffers t
|
|
|
|
nrepl-log-messages nil
|
2018-10-07 22:20:18 -04:00
|
|
|
cider-font-lock-dynamically '(macro core function var)
|
|
|
|
cider-overlays-use-font-lock t
|
|
|
|
cider-prompt-for-symbol nil
|
|
|
|
cider-repl-display-help-banner nil
|
|
|
|
cider-repl-history-display-duplicates nil
|
2018-10-15 23:08:59 -04:00
|
|
|
cider-repl-history-display-style 'one-line
|
2018-10-15 16:18:43 -04:00
|
|
|
cider-repl-history-file (concat doom-cache-dir "cider-repl-history")
|
2018-10-15 23:08:59 -04:00
|
|
|
cider-repl-history-highlight-current-entry t
|
|
|
|
cider-repl-history-quit-action 'delete-and-restore
|
|
|
|
cider-repl-history-highlight-inserted-item t
|
|
|
|
cider-repl-history-size 1000
|
|
|
|
cider-repl-pop-to-buffer-on-connect 'display-only
|
|
|
|
cider-repl-result-prefix ";; => "
|
|
|
|
cider-repl-print-length 100
|
|
|
|
cider-repl-use-clojure-font-lock t
|
|
|
|
cider-repl-use-pretty-printing t
|
|
|
|
cider-repl-wrap-history nil
|
|
|
|
cider-stacktrace-default-filters '(tooling dup))
|
|
|
|
|
2018-10-07 22:20:18 -04:00
|
|
|
;; TODO: Add mode-local labels when general support is in.
|
2018-12-23 23:54:27 -05:00
|
|
|
(map! (:localleader
|
|
|
|
(:map clojure-mode-map
|
|
|
|
"'" #'cider-jack-in
|
|
|
|
"\"" #'cider-jack-in-clojurescript)
|
|
|
|
(:map cider-mode-map
|
|
|
|
;; eval
|
|
|
|
(:prefix "e"
|
|
|
|
"d" #'cider-eval-defun-at-point
|
|
|
|
"D" #'cider-insert-defun-in-repl
|
|
|
|
"e" #'cider-eval-last-sexp
|
|
|
|
"E" #'cider-insert-last-sexp-in-repl
|
|
|
|
"r" #'cider-eval-region
|
|
|
|
"R" #'cider-insert-region-in-repl
|
|
|
|
"u" #'cider-undef)
|
|
|
|
;; go/jump
|
|
|
|
(:prefix "g"
|
|
|
|
"b" #'cider-pop-back
|
|
|
|
"g" #'cider-find-var
|
|
|
|
"n" #'cider-find-ns)
|
|
|
|
;; help
|
|
|
|
(:prefix "h"
|
|
|
|
"n" #'cider-find-ns
|
|
|
|
"a" #'cider-apropos
|
|
|
|
"d" #'cider-doc
|
|
|
|
"g" #'cider-grimoire-web
|
|
|
|
"j" #'cider-javadoc)
|
|
|
|
;; inspect
|
|
|
|
(:prefix "i"
|
|
|
|
"i" #'cider-inspect
|
|
|
|
"r" #'cider-inspect-last-result)
|
|
|
|
;; macro
|
|
|
|
(:prefix "m"
|
|
|
|
"e" #'cider-macroexpand-1
|
|
|
|
"E" #'cider-macroexpand-al)
|
|
|
|
;; namespace
|
|
|
|
(:prefix "n"
|
|
|
|
"n" #'cider-browse-ns
|
|
|
|
"N" #'cider-browse-ns-all)
|
|
|
|
;; repl
|
|
|
|
(:prefix "r"
|
|
|
|
"n" #'cider-repl-set-ns
|
|
|
|
"q" #'cider-quit
|
|
|
|
"r" #'cider-refresh
|
|
|
|
"R" #'cider-restart
|
|
|
|
"b" #'cider-switch-to-repl-buffer
|
|
|
|
"B" #'+clojure/cider-switch-to-repl-buffer-and-switch-ns
|
|
|
|
"c" #'cider-repl-clear-buffer)))
|
2018-10-16 02:03:23 -04:00
|
|
|
|
2018-12-23 23:54:27 -05:00
|
|
|
(:when (featurep! :feature evil +everywhere)
|
|
|
|
:map cider-repl-mode-map :i [S-return] #'cider-repl-newline-and-indent
|
|
|
|
:map cider-repl-history-mode-map
|
|
|
|
:i [return] #'cider-repl-history-insert-and-quit
|
|
|
|
:i "q" #'cider-repl-history-quit
|
|
|
|
:i "l" #'cider-repl-history-occur
|
|
|
|
:i "s" #'cider-repl-history-search-forward
|
|
|
|
:i "r" #'cider-repl-history-search-backward
|
|
|
|
:i "U" #'cider-repl-history-undo-other-window)))
|
2017-11-03 19:28:05 -04:00
|
|
|
|
2018-08-19 14:29:21 -05:00
|
|
|
(def-package! clj-refactor
|
2018-09-08 03:55:11 +03:00
|
|
|
:hook (clojure-mode . clj-refactor-mode)
|
2018-08-19 14:29:21 -05:00
|
|
|
:config
|
|
|
|
(map! :map clj-refactor-map
|
|
|
|
:localleader
|
2018-10-15 18:43:56 -04:00
|
|
|
:n "R" #'hydra-cljr-help-menu/body))
|
2018-09-07 20:35:29 -07:00
|
|
|
|
2018-09-09 10:15:20 -07:00
|
|
|
(def-package! flycheck-joker
|
2018-09-09 16:35:16 -04:00
|
|
|
:when (featurep! :feature syntax-checker)
|
|
|
|
:after flycheck))
|