]> code.delx.au - gnu-emacs-elpa/blob - README.mdown
db5e36f5ffeb68c22c9fe8f4a7d0449b3b5019d1
[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=ZCGmZK4V7Sg
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)
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/plugins/yasnippet/extras/imported"))
80 (yas/global-mode 1)
81
82 Open some rails file (model, app, etc) and start using the textmate snippets.
83 Note thqt in the example above we abandon the default snippet collection on
84 `~/.emacs.d/plugins/yasnippet/snippets`
85
86 # Documentation, issues, etc
87
88 Please refer to the comprehensive [documentation] [docs] for full customization
89 and support. If you find a bug, please report it on
90 [the GitHub issue tracker][issues]. (please **do not** submit new issues to the old
91 [googlecode tracker][googlecode tracker])
92
93 If you run into problems using YASnippet, or have snippets to contribute, post
94 to the [yasnippet google group][forum]. Thank you very much for using YASnippet!
95
96 [docs]: http://capitaomorte.github.com/yasnippet/
97 [issues]: https://github.com/capitaomorte/yasnippet/issues
98 [googlecode tracker]: http://code.google.com/p/yasnippet/issues/list
99 [forum]: http://groups.google.com/group/smart-snippet
100
101