Intro
YASnippet is a template system for emacs. It allows you to type a abbrevation and automatically expand the abbreviation into function templates.
Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML, CSS and more.
Yasnippet system is inspired from TextMate's template system. You can use a tool to import any TextMate template you have to YASnippet.
Video Demo
Watch Demo at YouTube. (download higher resolution: yasnippet.avi)
Brief Install Instruction
There are two archives of YASnippet. One is a single file compiled “bundle”, and the other is normal. If all you need is to use the builtin templates, download the bundle one. If you want to add your own templates, download the normal one.
Bundle Install
- Download yasnippet-bundle on the right sidebar and unpack it.
- You'll get a file named yasnippet-bundle.el, put it in ~/.emacs.d/plugins/ (create that directory if not exists).
- Open the file in Emacs, and type Alt+x eval-buffer.
That's it.
Now, open any one of your language file, you'll see a menu YASnippet. You can pull the menu to insert a template. Or, you can type the pre- defined abbrev and press TAB to expand it.
To have emacs load YASnippet everytime it starts, put the following in your .emacs:
(add-to-list 'load-path "~/.emacs.d/plugins") (require 'yasnippet-bundle)
For full install of the normal archive, just download and unpack the latest yasnippet-x.y.z.tar.bz2. You'll get a directory named `yasnippet, put it in ~/.emacs.d/plugins/ and add the following in your .emacs:
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet") (require 'yasnippet) ;; not yasnippet-bundle (yas/initialize) (yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
For full customization, please refer to the document.
Bugs, Contribution, Support
If you found a bug, please report it at issues list.
If you have a problem using YASnippet, or have template to contribute, please post at the discussion forum at: yasnippet google group
Thank you very much for using YASnippet!