Cider

CIDER(Clojure(Script) Interactive Development Environment that Rocks!)

단축키

분류단축키내용함수
평가
C-M-x현재 defun 평가cider-eval-defun-at-point
C-c M-;cider-eval-defun-to-comment
C-c C-ecider-eval-last-sexp
C-c C-m매크로 확장(1단계)cider-macroexpand-1
C-c M-m매크로 확장(전체)cider-macroexpand-all
C-c M-n (M-)nREPL 네임스페이스 설정cider-repl-set-ns
C-c C-v C-v현재 sexp 평가(comment 블록 안에서도 평가가능)cider-eval-sexp-at-point
이동
M-.정의로 이동cider-find-var
M-,되돌아가기cider-pop-back
C-c C-zREPL로 이동cider-switch-to-repl-buffer
헬퍼
M-TAB자동완성complete-symbol
문서
C-c C-d C-d문서보기(클로저)cider-doc
C-c C-d C-j문서보기(자바)cider-javadoc
접속관련
C-c C-x C-c C-j접속cider-connect-clj
C-c C-q종료cider-quit
C-c M-r재시작cider-restart
테스트
C-c C-t C-t테스트cider-test-run-test
C-c C-t C-g테스트(다시)cider-test-rerun-test
C-c C-t C-n테스트(현재 이름공간만)cider-test-run-ns-tests
C-c C-t C-r테스트(실패한 테스트만)cider-test-rerun-failed-tests
멈추었을시
C-c C-b인터럽트 시그날cider-interrupt

설정

(use-package clojure-mode
  :ensure t
  :requires cider
  :config
  (add-hook 'clojure-mode-hook 'subword-mode)
  (add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)

  ;; (add-hook 'clojure-mode-hook 'enable-paredit-mode)
  (define-clojure-indent
   (implement '(1 (1)))
   (letfn     '(1 ((:defn)) nil))
   (proxy     '(2 nil nil (1)))
   (reify     '(:defn (1)))
   (deftype   '(2 nil nil (1)))
   (defrecord '(2 nil nil (1)))
   (specify   '(1 (1)))
   (specify   '(1 (1)))
   ;;
   (fn-traced '(1 (1))))

  (define-key clojure-mode-map (kbd "C-;") 'mark-sexp)
  (customize-set-variable 'clojure-align-forms-automatically t)

  ;; eye-candy
  (add-to-list 'auto-coding-alist '("\\.clj\\'" . utf-8))
  (add-to-list 'auto-coding-alist '("\\.cljs\\'" . utf-8))
  (add-to-list 'auto-coding-alist '("\\.cljx\\'" . utf-8))

  (font-lock-add-keywords
   'clojure-mode `(("(\\(fn\\)[\[[:space:]]"
                    (0 (progn (compose-region (match-beginning 1)
                                              (match-end 1) "λ")
                              nil)))))
  (font-lock-add-keywords
   'clojure-mode `(("\\(#\\)("
                    (0 (progn (compose-region (match-beginning 1)
                                              (match-end 1) "ƒ")
                              nil)))))
  (font-lock-add-keywords
   'clojure-mode `(("\\(#\\){"
                    (0 (progn (compose-region (match-beginning 1)
                                              (match-end 1) "∈")
                              nil))))))