diff --git a/faq.html b/faq.html index 6b9a552..bd48b66 100644 --- a/faq.html +++ b/faq.html @@ -7,7 +7,7 @@ - + @@ -131,8 +131,9 @@ for the JavaScript code in this tag.
  • Why is there an extra newline?
  • Why doesn't TAB expand a snippet?
  • Why doesn't TAB navigation work with flyspell
  • -
  • How do I turn off the minor mode where in some buffers
  • -
  • How do I define an abbrev key containing characters not supported by
  • +
  • How to I use alternative keys, i.e. not TAB?
  • +
  • How do I turn off the minor mode where in some buffers?
  • +
  • How do I define an abbrev key containing characters not supported by
  • @@ -272,7 +273,7 @@ active:

    This is apparently related to overlay priorities. For some reason, the keymap property of flyspell's overlays always takes priority over the -same property in yasnippet's overlays, even if one sets the latter's +same property in YASnippet's overlays, even if one sets the latter's priority property to something big. If you know emacs-lisp and can solve this problem, drop a line in the discussion group. @@ -282,10 +283,40 @@ solve this problem, drop a line in the

    -

    How do I turn off the minor mode where in some buffers

    +

    How to I use alternative keys, i.e. not TAB?

    +

    +Edit the keymaps yas-minor-mode-map and +yas-keymap as you would any other keymap: +

    + + + +
    (define-key yas-minor-mode-map (kbd "<tab>") nil)
    +(define-key yas-minor-mode-map (kbd "TAB") nil)
    +(define-key yas-minor-mode-map (kbd "<the new key>") 'yas-expand)
    +
    +;;keys for navigation
    +(define-key yas-keymap [(tab)]       nil)
    +(define-key yas-keymap (kbd "TAB")   nil)
    +(define-key yas-keymap [(shift tab)] nil)
    +(define-key yas-keymap [backtab]     nil)
    +(define-key yas-keymap (kbd "<new-next-field-key>") 'yas-next-field-or-maybe-expand)
    +(define-key yas-keymap (kbd "<new-prev-field-key>") 'yas-prev)
    +
    + + +
    + +
    + +
    +

    How do I turn off the minor mode where in some buffers?

    +
    + +

    The best way, since version 0.6.1c, is to set the default value of the variable yas-dont-activate to a lambda function like so: @@ -309,9 +340,9 @@ but only once you have setup your yas-root-directory.

    -
    -

    How do I define an abbrev key containing characters not supported by

    -
    +
    +

    How do I define an abbrev key containing characters not supported by

    +

    the filesystem?

    @@ -332,7 +363,7 @@ filename as a trigger key in this case.

    You should rather use the # key: directive to specify the key of the defined snippet explicitly and name your snippet with an arbitrary valid -filename, lt.yasnippet for example, using < for the # key: +filename, lt.YASnippet for example, using < for the # key: directive:

    @@ -349,7 +380,7 @@ directive:
    -

    Generated by Org version 7.9.3f with Emacs version 24 on 2013-11-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb +


    Generated by Org version 7.9.3f with Emacs version 24 on 2013-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4

    Validate XHTML 1.0

    diff --git a/index.html b/index.html index 57e867a..3988560 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ - + @@ -122,221 +122,67 @@ for the JavaScript code in this tag.

    Yet another snippet extension

    - - - -
    -

    Quick start

    -
    - - -

    - YASnippet is a template system for Emacs. It allows you to type an - abbreviation and automatically expand it into function templates. Bundled - language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML, - CSS and more. The snippet syntax is inspired from TextMate's syntax, you can - even import most TextMate snippets -

    -

    - YASnippet is an original creation of pluskid who also wrote its predecessor - smart-snippet. -

    - -
    - -
    -

    Watch a demo

    -
    - - -

    - On youtube. -

    -
    - -
    - -
    -

    Installation

    -
    - - -

    - Clone this repository somewhere -

    - - - -
    $ cd ~/.emacs.d/plugins
    -$ git clone https://github.com/capitaomorte/yasnippet
    -
    - - -

    - Add the following in your .emacs file: -

    - - - -
    (add-to-list 'load-path
    -              "~/.emacs.d/plugins/yasnippet")
    -(require 'yasnippet)
    -(yas-global-mode 1)
    -
    - - -

    - Add your own snippets to ~/.emacs.d/snippets by placing files there or - invoking yas-new-snippet. -

    -
    - -
    - -
    -

    Import textmate snippets (rails example)

    -
    - - -

    - YASnippet lets you use TextMate bundles directly: -

    - - - -
    $ cd ~/.emacs.d/plugins
    -$ git clone https://github.com/capitaomorte/yasnippet
    -$ cd yasnippet
    -$ git submodule init
    -$ git submodule update
    -$ gem install plist trollop
    -$ rake convert_bundles             # will convert ruby, rails and html bundles from drnic
    -
    - - -

    - Then, in your .emacs file -

    - - - -
    (add-to-list 'load-path
    -              "~/.emacs.d/plugins/yasnippet")
    -(require 'yasnippet)
    -(setq yas-snippet-dirs '("~/.emacs.d/snippets" "~/.emacs.d/extras/imported"))
    -(yas-global-mode 1)
    -
    - - -

    - Open some rails file (model, app, etc) and start using the textmate - snippets. Consider that this is a work-in-progress and many snippets/commands - might not work. Patches welcome! -

    -
    - -
    - -
    -

    Contributing snippets

    -
    - - -

    - Please do not ask me to add snippets to the default collection under - /snippets. This collection is considered frozen. By customizing - yas-snippet-dirs you can point yasnippet to good - snippet collections out there. -

    -

    - The extras/textmate-import.rb tool can import many actual Textmate - snippets. I'm focusing on developing it and the accompanying yas-setup.el - files that guide it with more difficult importations. The idea is to deprecate - /snippets and replace it with extras/imported. -

    -
    - -
    - -
    -

    Documentation

    -
    - - -

    - The documentation has been split into separate parts: +

    The YASnippet documentation has been split into separate parts:

      -
    1. Organizing Snippets - Describes ways to organize your snippets in the hard disk. - -
    2. -
    3. Expanding Snippets - Describes how YASnippet chooses snippets for expansion at point. +
    4. README

      - Maybe, you'll want some snippets to be expanded in a particular mode, - or only under certain conditions, or be prompted using ido, etc… + Contains an introduction, installation instructions and other important + notes. +

      +
    5. +
    6. Organizing Snippets + +

      + Describes ways to organize your snippets in the hard disk. +

      +
    7. +
    8. Expanding Snippets + +

      + Describes how YASnippet chooses snippets for expansion at point. +

      +

      + Maybe, you'll want some snippets to be expanded in a particular mode, + or only under certain conditions, or be prompted using ido, etc…

    9. Writing Snippets - Describes the YASnippet definition syntax, which is very close (but - not equivalent) to Textmate's. Includes a section about converting - TextMate snippets. +

      + Describes the YASnippet definition syntax, which is very close (but + not equivalent) to Textmate's. Includes a section about converting + TextMate snippets. +

    10. The YASnippet menu - Explains how to use the YASnippet menu to explore, learn and modify - snippets. +

      + Explains how to use the YASnippet menu to explore, learn and modify + snippets. +

      +
    11. +
    12. Frequently asked questions + +

      + Answers to frequently asked questions. +

    13. YASnippet Symbol Reference - An automatically generated listing of all YASnippet commands, - (customization) variables, and functions. -
    14. + +

      + An automatically generated listing of all YASnippet commands, + (customization) variables, and functions. +

    -
    -
    -

    Bugs, discussion, contributions, etc

    -
    - - -

    - If you think you've found a bug, please report it on the GitHub issue tracker - (please **do not** submit new issues to the old googlecode tracker). -

    -

    - If you run into problems using YASnippet, or have snippets to contribute, - post to the yasnippet forum. Thank you very much for using YASnippet! -

    -
    -
    -
    -
    -
    -

    Generated by Org version 7.9.3f with Emacs version 24 on 2013-11-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb +


    Generated by Org version 7.9.3f with Emacs version 24 on 2013-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4

    Validate XHTML 1.0

    diff --git a/snippet-development.html b/snippet-development.html index 99d44c9..c8bb17b 100644 --- a/snippet-development.html +++ b/snippet-development.html @@ -7,7 +7,7 @@ - + @@ -158,7 +158,6 @@ for the JavaScript code in this tag.
  • Nested placeholder fields
  • -
  • Importing TextMate snippets
  • @@ -298,10 +297,10 @@ Here's a list of currently supported directives:

    -This is the probably the most important directive, it's the abbreviation -you type to expand a snippet just before hitting yas-trigger-key. If -you don't specify this the snippet will not be expandable through the -key mechanism. +This is the probably the most important directive, it's the +abbreviation you type to expand a snippet just before hitting the key +that runs yas-expand. If you don't specify this +the snippet will not be expandable through the trigger mechanism.

    @@ -496,7 +495,7 @@ escaped as \\ sometimes. Emacs-Lisp code can be embedded inside the template, written inside back-quotes (==). The lisp forms are evaluated when the snippet is being expanded. The evaluation is done in the same buffer as the -snippet being expanded. +snippet being expanded.

    Here's an example for c-mode` to calculate the header file guard @@ -785,14 +784,13 @@ enter snippet field 2. This one makes use of \section{${1:"Titel der Tour"}}% \index{$1}% \label{{2:"waiting for reftex-label call..."$(unless yas-modified-p (reftex-label nil 'dont- -insert))}}% +insert))}}%

    -The function yas-verify-value has another neat trick, and makes use of -yas-moving-away-p. Try it and see! Also, check out this -thread +The function yas-verify-value has another neat trick, and makes use +of yas-moving-away-p. Try it and see! Also, check out this thread

    @@ -824,89 +822,13 @@ the exit marker. By the way, C-d will only clear the field if you cursor is at the beginning of the field and it hasn't been changed yet. Otherwise, it performs the normal Emacs delete-char command. -

    -
    -
    - - - -
    -

    Importing TextMate snippets

    -
    - - -

    -There are a couple of tools that take TextMate's ".tmSnippet" xml files -and create YASnippet definitions: -

    - - - - - -

    -In this section, i'll shortly cover the second option. -

    -

    -Download the textmate_import.rb tool and the TextMate bundle you're -interested in. -

    - - - -
    $ curl -O http://yasnippet.googlecode.com/svn/trunk/extras/textmate_import.rb
    -$ svn export http://svn.textmate.org/trunk/Bundles/HTML.tmbundle/
    -
    - - -

    -Then invoke textmate_import.rb like this: -

    - - - -
    $ ./textmate_import.rb -d HTML.tmbundle/Snippets/ -o html-mode -g HTML.tmbundle/info.plist
    -
    - - -

    -You should end up with a html-mode subdir containing snippets exported -from textmate. -

    - - - -
    $ tree html-mode # to view dir contents, if you have 'tree' installed
    -
    - - -

    -The -g is optional but helps the tool figure out the grouping. -According to Organizing Snippets, don't forget to touch -.yas-make-groups and .yas-ignore-filename-triggers inside the -html-mode dir. -

    -

    -Also try textmate_import.rb --help for a list of options. -

    -

    -Please note that snippet importation is not yet perfect. You'll probably -have some adjustments to some/many snippets. Please contribute these -adjustments to the google group or, better yet, patch the -textmate_import.rb to automatically perform them and submit that.

    +
    -

    Generated by Org version 7.9.3f with Emacs version 24 on 2013-11-28T23:36-0500 from eda83304afc7894f0b5ddc15b04b041be52b94fb +


    Generated by Org version 7.9.3f with Emacs version 24 on 2013-12-02T19:38+0000 from 582e3680b66a62f304034376516207c006f77fe4

    Validate XHTML 1.0

    diff --git a/snippet-expansion.html b/snippet-expansion.html index 03b3e21..84d804f 100644 --- a/snippet-expansion.html +++ b/snippet-expansion.html @@ -7,7 +7,7 @@ - + @@ -330,9 +330,11 @@ See the YASnippet Menu.

    -To integrate with hippie-expand, just put yas-hippie-try-expand in -hippie-expand-try-functions-list. This probably makes more sense when -placed at the top of the list, but it can be put anywhere you prefer. +To integrate with hippie-expand, just put +yas-hippie-try-expand in +hippie-expand-try-functions-list. This probably makes more sense +when placed at the top of the list, but it can be put anywhere you +prefer.

    @@ -344,9 +346,10 @@ placed at the top of the list, but it can be put anywhere you prefer.

    -Sometimes you might want to expand a snippet directly from you own elisp -code. You should call yas-expand-snippet instead of yas-expand in -this case. +Sometimes you might want to expand a snippet directly from you own +elisp code. You should call +yas-expand-snippet instead of +yas-expand in this case.

    As with expanding from the menubar, the condition system and multiple @@ -418,9 +421,9 @@ In particular, the following things matter:

  • Buffer-local list of extra modes

    - Use yas-activate-extra-mode to consider snippet tables whose name - does not correspond to a major mode. Typically, you call this from - a minor mode hook, for example: + Use yas-activate-extra-mode to + consider snippet tables whose name does not correspond to a major + mode. Typically, you call this from a minor mode hook, for example:

  • @@ -437,7 +440,9 @@ In particular, the following things matter: