(require 'auto-complete-config)
(require 'clojure-mode)
(require 'cider-mode)
(require 'ac-cider)
(ac-config-default)
;(add-hook 'cider-repl-mode-hook 'ac-cider-setup)
(add-hook 'cider-mode-hook 'ac-cider-setup)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'cider-repl-mode))
(add-hook 'clojure-mode-hook 'paredit-mode)
;(add-hook 'clojurescript-mode-hook 'paredit-mode)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(setq cider-repl-pop-to-buffer-on-connect nil)
(require 'highlight-parentheses)
(add-hook 'clojure-mode-hook
(lambda ()
(highlight-parentheses-mode t)))
(defun set-auto-complete-as-completion-at-point-function ()
(setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
;(add-hook 'cider-repl-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)
(eval-after-load "cider"
'(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-popup-doc))
我的包裹是:
ac-cider
auto-complete
auto-indent
cider
clojure-mode
highlight-parentheses
parendit
popup
rainbow-delimiters
我不想对 repl 和 script 使用自动完成功能,所以我评论了它们。
你可能不需要它们,但它们都很有用。如果您不想更改 init.el 文件,最好使用列出的所有包。
完成后,使用 Lein 创建一个项目,然后添加
:plugins [[cider/cider-nrepl "0.8.2"]]
到 project.clj 文件。
现在,它几乎完成了。用 Emacs 打开一个源文件,然后运行
M-x cider-jack-in
那么你必须能够对代码使用自动完成功能!