Emacs Yasnippet安装

时间:2011-11-22 10:19:50

标签: templates emacs code-snippets

尝试从以下位置为emacs 23安装yasnippet:

https://github.com/capitaomorte/yasnippet

首先,我尝试了快速安装,但“快速”安装的yasnippet-bundle.el似乎不在存储库中?

其次,我尝试了完整安装。

尝试进行完整安装时出现以下错误:

[yas] Check your `yas/snippet-dirs': ~/.emacs.d/snippets is not a directory

我已下载最新的捆绑capitaomorte-yasnippet-e53c41d/并已解压缩到.emacs.d/plugins/

我的`.emacs'的加法是:

(add-to-list 'load-path
              "~/.emacs.d/plugins/capitaomorte-yasnippet-e53c41d")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/capitaomorte-yasnippet-e53c41d/snippets")

基本上,安装说明似乎与最新的src不同步。有谁知道如何安装它?

1 个答案:

答案 0 :(得分:4)

您需要初始化yas/root-directory。以下是我如何设置yasnippet

(require 'yasnippet "~/emacs/addons/yasnippet.el")
(yas/initialize)
(setq yas/root-directory "~/emacs/snippets")
(yas/load-directory yas/root-directory)