Auto complete

hippie-expand提供的补全功能帮了我不少忙,可是我个人不太偏好这种MS Dos方式的补全。auto-complete.el正合我意,它的作者用一段视频展示了auto complete提供怎样的功能。

我的配置如下:

(when (require-maybe 'auto-complete)
  (global-auto-complete-mode t)
  (define-key ac-complete-mode-map "C-n" 'ac-next)
  (define-key ac-complete-mode-map "C-p" 'ac-previous)
  (setq ac-auto-start 4)
  (add-hook 'emacs-lisp-mode-hook
            (lambda ()
              (make-local-variable 'ac-sources)
              (setq ac-sources '(ac-source-words-in-buffer ac-source-symbols))))

  (defvar ac-source-etags
    '((candidates
       . (lambda () (all-completions ac-target (tags-completion-table))))))
  (defun wl-add-ac-source-etags ()
    (make-local-variable 'ac-sources)
    (add-to-list 'ac-sources 'ac-source-etags))

  (add-hook 'c-mode-common-hook 'wl-add-ac-source-etags))

4 thoughts on “Auto complete

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据