cd ~/.emacs.d/plugins git clone https://github.com/capitaomorte/yasnippet.git
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet") (require 'yasnippet) (yas/global-mode 1)在这里就安装完毕了,之后尼可以把自己的代码片段放到.emacs.d/snippets 文件夹中了。
cd ~/.emacs.d/plugins git clone https://github.com/auto-complete/auto-complete.git接下来是编译了,编译可以用make,或者用emacs,make的话,他一老说我缺少popup-el,然后用install-elisp安装popup后,编译器还是说缺少popup,蛋疼死了,所以就直接用emacs安装了,命令如下:
emacs -batch -l etc/install.el
安装成功后在配置文件中加入如下几行 (add-to-list 'load-path "~/.emacs.d") ; This may not be appeared if you have already added. (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") (ac-config-default)然后重新启动emacs,就可以同时使用yasnippet与auto-complete了
sudo apt-get install llvm* sudo apt-get install clang*然后把整个源代码clone到.emacs.d中
cd .emacs.d/ git clone https://github.com/Golevka/emacs-clang-complete-async.git然后运行make命令,再接着把编译出来的二进制文件与之前的el文件复制到.emacs.d中
cp clang-complete auto-complete-clang-async.el ~/.emacs.d最后在.emacs文件中加入以下内容
(require 'auto-complete-clang-async) (defun ac-cc-mode-setup () (setq ac-clang-complete-executable "~/.emacs.d/clang-complete") (setq ac-sources '(ac-source-clang-async)) (ac-clang-launch-completion-process) ) (defun my-ac-config () (add-hook 'c-mode-common-hook 'ac-cc-mode-setup) (add-hook 'auto-complete-mode-hook 'ac-common-setup) (global-auto-complete-mode t)) (my-ac-config)大功告成,享受自动补全带来的快感把!对了,这个插件还有一个在实验中的功能非常给力,就是自动检测语法错误,貌似是利用了flymake。只要在alt+x,然后输入ac-clang-syntax-check。或者你也可以自己设置一个快捷键!