lang/clojure: More changes

- Add a popup rule for the history buffer, since we want to see the REPL change while it's open
- Add hooks to enable company fuzzy completion
- Add more cider configuration options
- Configure Shift-Return to insert a newline and indent in the REPL without submitting the result
- Bind normal state keybindings for the CIDER history buffer
This commit is contained in:
Michael Fiano 2018-10-15 23:08:59 -04:00 committed by GitHub
parent 5ad27da2f1
commit bd1f2ec4d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,11 @@
(after! clojure-mode
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
(set-popup-rules!
'(("^\\*cider-error*" :ignore t)
("^\\*cider-repl" :quit nil :select nil)
("^\\*cider-repl-history" :vslot 2 :ttl nil)))
(defun +clojure|cider-switch-to-repl-buffer-and-switch-ns ()
(interactive)
(cider-switch-to-repl-buffer t))
@ -14,27 +19,46 @@
:commands (cider-jack-in cider-jack-in-clojurescript)
:hook (clojure-mode . cider-mode)
:init
(set-popup-rule! "^\\*cider-repl" :quit nil :select nil)
(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)
(add-hook 'cider-repl-mode-hook #'cider-company-enable-fuzzy-completion)
(add-hook 'cider-mode-hook #'cider-company-enable-fuzzy-completion)
(add-hook 'cider-mode-hook #'eldoc-mode)
:config
(setq nrepl-log-messages nil
nrepl-hide-special-buffers t
(setq nrepl-hide-special-buffers t
nrepl-log-messages nil
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-pop-to-buffer-on-connect t
cider-repl-history-display-duplicates nil
cider-repl-history-display-style 'one-line
cider-repl-history-file (concat doom-cache-dir "cider-repl-history")
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-repl-history-display-duplicates nil
cider-repl-history-file (concat doom-cache-dir "cider-repl-history")
cider-stacktrace-default-filters '(tooling dup)
cider-repl-use-clojure-font-lock t)
cider-stacktrace-default-filters '(tooling dup))
(when (featurep! :feature evil +everywhere)
(evil-define-key 'insert cider-repl-mode-map
[S-return] #'cider-repl-newline-and-indent)
(evil-define-key 'normal cider-repl-history-mode-map
"q" 'cider-repl-history-quit
[return] 'cider-repl-history-insert-and-quit
"l" 'cider-repl-history-occur
"s" 'cider-repl-history-search-forward
"r" 'cider-repl-history-search-backward
"U" 'cider-repl-history-undo-other-window))
;; TODO: Add mode-local labels when general support is in.
(map! :localleader