]> code.delx.au - gnu-emacs-elpa/blob - README.mdown
correct permissions for README.mdown
[gnu-emacs-elpa] / README.mdown
1 # Intro
2
3 **YASnippet** is a template system for Emacs. It allows you to type an
4 abbreviation and automatically expand it into function
5 templates. Bundled language templates includes: C, C++, C#, Perl,
6 Python, Ruby,
7
8 SQL, LaTeX, HTML, CSS and more. The snippet syntax is inspired from
9 [TextMate's][textmate-snippets] syntax, you can even
10 [import][import-docs] most TextMate templates to YASnippet. Watch
11 [a demo on YouTube][youtube-demo] or download a
12 [higher resolution version][high-res-demo]
13
14 [textmate-snippets]: http://manual.macromates.com/en/snippets
15 [import-docs]: http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#importing-textmate-snippets
16 [youtube-demo]: http://www.youtube.com/watch?v=76Ygeg9miao
17 [high-res-demo]: http://yasnippet.googlecode.com/files/yas_demo.avi
18
19 # Installation
20
21 ## Install the most recent version
22
23 Clone this repository somewhere
24
25 $ cd ~/.emacs.d/plugins
26 $ git clone https://github.com/capitaomorte/yasnippet
27
28 Add the following in your `.emacs` file:
29
30 (add-to-list 'load-path
31 "~/.emacs.d/plugins/yasnippet")
32 (require 'yasnippet) ;; not yasnippet-bundle
33 (yas/global-mode 1)
34
35 Add your own snippets to `~/.emacs.d/snippets` by placing files there or invoking `yas/new-snippet`.
36
37 ## Install yasnippet with el-get
38
39 El-get is a nice way to get the most recent version, too
40
41 See https://github.com/dimitri/el-get for instructions
42
43 # Contributing snippets
44
45 Please do not ask me to add snippets to the default collection under
46 `/snippets`. This is considered frozen and by customizing
47 `yas/snippet-dirs` you can point yasnippet to good snippet collections
48 out there.
49
50 There is a tool `extras/textmate-import.rb` than can import many
51 actual Textmate snippets and there are
52 `extras/imported/*-mode/.yas-setup.el` files that can help it with the
53 more difficult importation.
54
55 I'm focusing on developping `textmate-import.rb` tool and the
56 `yas-setup.el` files. In the future `/snippets` snippets will be
57 deprecated and replaced with `extras/imported`.
58
59 Follow through the following example to start using these snippets for
60 rails development. It will convert `ruby`, `rails` and `html` bundles
61 from drnic's github repositories based on corresponding
62 `.yas-setup.el` files.
63
64 ## Using imported textmate snippets (rails example)
65
66 After cloning this repository to `~/.emacs.d/plugins/yasnippet`
67
68 cd ~/.emacs.d/plugins/yasnippet
69 git submodule init
70 git submodule update
71 gem install plist trollop
72 rake convert_bundles # will convert ruby, rails and html bundles from drnic
73
74 Then, in your .emacs file
75
76 (add-to-list 'load-path
77 "~/.emacs.d/plugins/yasnippet")
78 (require 'yasnippet)
79 (setq yas/snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))
80 (yas/global-mode 1)
81
82 Open some rails file (model, app, etc) and start using the textmate snippets.
83
84 # Documentation, issues, etc
85
86 Please refer to the comprehensive [documentation] [docs] for full customization
87 and support. If you find a bug, please report it on
88 [the GitHub issue tracker][issues]. (please **do not** submit new issues to the old
89 [googlecode tracker][googlecode tracker])
90
91 If you run into problems using YASnippet, or have snippets to contribute, post
92 to the [yasnippet google group][forum]. Thank you very much for using YASnippet!
93
94 [docs]: http://capitaomorte.github.com/yasnippet/
95 [issues]: https://github.com/capitaomorte/yasnippet/issues
96 [googlecode tracker]: http://code.google.com/p/yasnippet/issues/list
97 [forum]: http://groups.google.com/group/smart-snippet
98
99