#+OPTIONS: toc:1\r
#+STARTUP: showall\r
\r
-#+STYLE: <link rel="stylesheet" type="text/css" href="assets/stylesheet.css" />\r
+#+STYLE: <link rel="stylesheet" type="text/css" href="stylesheets/styles.css" />\r
\r
# External links\r
#\r
#+LINK: smart-snippet http://code.google.com/p/smart-snippet\r
#+LINK: pluskid http://pluskid.lifegoo.org\r
\r
-\r
#+LINK: screencast http://www.youtube.com/watch?v=ZCGmZK4V7Sg\r
#+LINK: docs http://capitaomorte.github.com/yasnippet\r
#+LINK: issues https://github.com/capitaomorte/yasnippet/issues\r
:CUSTOM_ID: import-textmate\r
:END:\r
\r
-Clone the yasnippet repository to `~/.emacs.d/plugins/yasnippet`\r
+Clone the yasnippet repository to =~/.emacs.d/plugins/yasnippet=\r
\r
+#+begin_example\r
cd ~/.emacs.d/plugins/yasnippet\r
git submodule init\r
git submodule update\r
gem install plist trollop\r
rake convert_bundles # will convert ruby, rails and html bundles from drnic\r
+#+end_example\r
\r
Then, in your .emacs file\r
\r
+#+begin_example\r
(add-to-list 'load-path\r
"~/.emacs.d/plugins/yasnippet")\r
(require 'yasnippet)\r
(setq yas/snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))\r
(yas/global-mode 1)\r
+#+end_example\r
\r
Open some rails file (model, app, etc) and start using the textmate snippets.\r
\r
to the [[forum][yasnippet forum]]. Thank you very much for using YASnippet!\r
\r
* Organizing snippets\r
-** Setting up =yas/snippet-dirs= before calling =yas/global-mode=\r
+\r
+** Setting up =yas/snippet-dirs=\r
\r
Snippet collections are stored in specially organized file hierarchies. These\r
are loaded by YASnippet into *snippet tables* which the triggering mechanism\r
expanded for you.\r
\r
An emacs variable =yas/snippet-dirs= tells YASnippet which collections to\r
-consider.\r
+consider. It's used when you activate =yas/global-mode= or call =yas/reload-all=\r
+interactively.\r
\r
-If you don't tweak it the default value of =yas/snippet-dirs= considers:\r
+The default considers:\r
\r
- a personal collection that YASnippet decides lives in =~/.emacs.d/snippets=\r
- the bundled collection, taken as a relative path to =yasnippet.el= localtion\r
\r
-You might and probably want to try out more snippet collections though:\r
+Do the following to try out more snippet collections though:\r
\r
#+begin_src emacs-lisp :exports both\r
;; Develop in ~/emacs.d/mysnippets, but also\r
collections later in the list. =yas/new-snippet= always stores snippets in the\r
first collection.\r
\r
-# Snippet definitions are put in plain text files. They are arranged\r
-# by sub-directories, and the snippet tables are named after these\r
-# directories.\r
+** Basic organization\r
+\r
+Snippet definitions are stored in plain text files. They are arranged by\r
+sub-directories. The directories name snippet tables, which in turn name\r
+Emacs major names. For example, snippets for =c-mode= are put in the\r
+``c-mode`` sub-directory while\r
+\r
+** The =.yas.parents= file\r
+\r
+It's very useful to have certain modes share snippets between themselves. To do\r
+this, choose a mode subdirectory and place a =.yas-parents= containing a\r
+whitespace-separated list of other mode names. When you reload those modes\r
+become parents of the original mode.\r
\r
-# The name corresponds to the Emacs mode where you want expansion to\r
-# take place. For example, snippets for ``c-mode`` are put in the\r
-# ``c-mode`` sub-directory.\r
+#+begin_example\r
+.\r
+|-- c-mode\r
+| |-- .yas-parents # contains "cc-mode text-mode"\r
+| `-- printf\r
+|-- cc-mode\r
+| |-- for\r
+| `-- while\r
+|-- java-mode\r
+| |-- .yas-parents # contains "cc-mode text-mode"\r
+| `-- println\r
+`-- text-mode\r
+ |-- email\r
+ `-- time\r
+#+end_example\r
\r
\r
\r
\r
\r
\r
-# The ``.yas.parents`` file\r
-# -------------------------\r
-\r
-# It's very useful to have certain modes share snippets between\r
-# themselves. To do this, choose a mode subdirectory and place a\r
-# ``.yas-parents`` containing a whitespace-separated list of other\r
-# mode names. When you reload those modes become parents of the\r
-# original mode.\r
-\r
-# .. sourcecode:: text\r
\r
-# $ tree\r
-# .\r
-# |-- c-mode\r
-# | |-- .yas-parents # contains "cc-mode text-mode"\r
-# | `-- printf\r
-# |-- cc-mode\r
-# | |-- for\r
-# | `-- while\r
-# |-- java-mode\r
-# | |-- .yas-parents # contains "cc-mode text-mode"\r
-# | `-- println\r
-# `-- text-mode\r
-# |-- email\r
-# `-- time\r
\r
# The ``.yas-make-groups`` file\r
# -----------------------------\r