]> code.delx.au - gnu-emacs-elpa/blob - README.org
Merge branch '0.8-fsf-changes'
[gnu-emacs-elpa] / README.org
1 # -*- mode: org; fill-column: 80 -*-
2 #+TITLE: Yet another snippet extension
3 #+OPTIONS: toc:1
4 #+STARTUP: showall
5
6 #+STYLE: <link rel="stylesheet" type="text/css" href="assets/stylesheet.css" />
7
8 # External links
9 #
10 #+LINK: smart-snippet http://code.google.com/p/smart-snippet
11 #+LINK: pluskid http://pluskid.lifegoo.org
12
13
14 #+LINK: screencast http://www.youtube.com/watch?v=ZCGmZK4V7Sg
15 #+LINK: docs http://capitaomorte.github.com/yasnippet
16 #+LINK: issues https://github.com/capitaomorte/yasnippet/issues
17 #+LINK: googlecode-tracker http://code.google.com/p/yasnippet/issues/list
18 #+LINK: forum http://groups.google.com/group/smart-snippet
19
20 *YASnippet* is a template system for Emacs. It allows you to type an
21 abbreviation and automatically expand it into function templates. Bundled
22 language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML,
23 CSS and more. The snippet syntax is inspired from TextMate's syntax, you can
24 even [[#import-textmate][import most TextMate snippets]]
25
26 YASnippet is an original creation of [[pluskid]] who also wrote its predecessor
27 [[smart-snippet]].
28
29 * Watch a demo [[screencast]]
30
31 * Install the most recent version with git
32
33 Clone this repository somewhere
34
35 #+BEGIN_EXAMPLE
36 $ cd ~/.emacs.d/plugins
37 $ git clone https://github.com/capitaomorte/yasnippet
38 #+END_EXAMPLE
39
40 Add the following in your =.emacs= file:
41
42 #+BEGIN_EXAMPLE
43 (add-to-list 'load-path
44 "~/.emacs.d/plugins/yasnippet")
45 (require 'yasnippet)
46 (yas/global-mode 1)
47 #+END_EXAMPLE
48
49 Add your own snippets to `~/.emacs.d/snippets` by placing files there or invoking `yas/new-snippet`.
50
51 * Install yasnippet with el-get
52
53 [[https://github.com/dimitri/el-get.gti][El-get]] is a nice way to get the most recent version.
54
55 * Import textmate snippets (rails example)
56 :PROPERTIES:
57 :CUSTOM_ID: import-textmate
58 :END:
59
60 Clone the yasnippet repository to `~/.emacs.d/plugins/yasnippet`
61
62 #+BEGIN_EXAMPLE
63 cd ~/.emacs.d/plugins/yasnippet
64 git submodule init
65 git submodule update
66 gem install plist trollop
67 rake convert_bundles # will convert ruby, rails and html bundles from drnic
68 #+END_EXAMPLE
69
70 Then, in your .emacs file
71
72 #+BEGIN_EXAMPLE
73 (add-to-list 'load-path
74 "~/.emacs.d/plugins/yasnippet")
75 (require 'yasnippet)
76 (setq yas/snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))
77 (yas/global-mode 1)
78 #+END_EXAMPLE
79
80 Open some rails file (model, app, etc) and start using the textmate snippets.
81
82 * Contributing snippets
83
84 Please do not ask me to add snippets to the default collection under
85 =/snippets=. This is considered frozen and by customizing =yas/snippet-dirs= you
86 can point yasnippet to good snippet collections out there.
87
88 The =extras/textmate-import.rb= tool can import many actual Textmate
89 snippets. See [[import-textmate]].
90
91 I'm focusing on developping =textmate-import.rb= tool and the =yas-setup.el=
92 files that guide it with more difficult importation. In the future =/snippets=
93 snippets will be deprecated and replaced with =extras/imported=.
94
95 * Documentation, issues, etc
96
97 Please refer to the comprehensive [[docs][documentation]] for full customization and
98 support. If you think you've found a bug, please report it on [[issues][the GitHub issue
99 tracker]]. (please **do not** submit new issues to the old [[googlecode-tracker][googlecode tracker]])
100
101 If you run into problems using YASnippet, or have snippets to contribute, post
102 to the [[forum][yasnippet forum]]. Thank you very much for using YASnippet!