Emacs安装auto-complete

分别下载各个el文件

auto-complete-mode 主源码库

https://github.com/auto-complete/auto-complete

把zip文件下载后,复制auto-complete.el、auto-complete-config.el和dict文件夹到放插件的文件夹(这里是~/.emacs.d/plugins/auto-complete文件夹)。

popup功能库

https://github.com/auto-complete/popup-el

使用fuzzy模式匹配

https://github.com/auto-complete/fuzzy-el

增强列表模式

https://github.com/winterTTr/emacs-of-winterTTr/tree/master/.emacs.d/plugins/auto-complete-suite/pos-tip

把popup.el、fuzzy.el、pos-tip.el复制到放插件的文件夹。

在.emacs中配置如下:

;;==配置auto-complete。内容较多单独放一个目录。==============
(add-to-list 'load-path "~/.emacs.d/plugins/auto-complete")
;;cl-lib.el在v24中才出现,v23是没有的,要单独下载。
(require 'auto-complete)
(require 'auto-complete-config)


;; 开启全局设定(包含哪些模式在ac-modes里查看)
;;(global-auto-complete-mode t)
;;添加web-mode模式,在该模式下会自动开启自动完成
;;http://stackoverflow.com/questions/8095715/emacs-auto-complete-mode-at-startup
(add-to-list 'ac-modes 'web-mode)

;;使用自带字典
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
(ac-config-default)

;; 输入3个字符才开始补全
(setq ac-auto-start 3)

;; 补全的快捷键,用于需要提前补全-当还没有输入指定个数字符时显示弹出菜单。
(global-set-key "M-/" 'auto-complete)  

;;使用增强的popup列表
(require 'pos-tip)
(setq ac-quick-help-prefer-pos-tip t)

;;使用quick-help
(setq ac-use-quick-help t)
(setq ac-quick-help-delay 0.5)

;; Show 0.8 second later
(setq ac-auto-show-menu 0.8)

;; 设置tab键的使用模式--??
;;(setq ac-dwim t)

;;使用fuzzy功能
(setq ac-fuzzy-enable t)

;;菜单
(setq ac-menu-height 12)
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")  
;;==end auto-complete===============================

重启emacs后如果有错误提示:File error: Cannot open load file, cl-lib

去下载 https://github.com/emacsmirror/cl-lib/blob/master/cl-lib.el

--END--

原文地址:https://www.cnblogs.com/ibgo/p/3685281.html