Difference between revisions of "Yasnippet"
Jump to navigation
Jump to search
m (formatting) |
(yasnippet + hippie expand) |
||
Line 23: | Line 23: | ||
== Common Customization == | == Common Customization == | ||
+ | |||
+ | === Use Yasnippet with Hippie Expand === | ||
+ | |||
+ | If you use [[Hippie Expand]], you can add [[Yasnippet]] to the list of expansion functions. For example if you want to try expanding snippets first: | ||
+ | {{Snippet|(setq hippie-expand-try-functions-list (cons 'yas/hippie-try-expand hippie-expand-try-functions-list))}} | ||
+ | |||
+ | You could do this globally, or for a specific mode using a [[mode hook]]. | ||
+ | |||
+ | {{Note|If you use {{Keys|Tab}} for [[Hippie Expand]], consider using a prefix for your snippets. Otherwise you may be trying to tab between possible expansions and find yourself tabbing through fields in an expanded snippet instead.}} | ||
== See Also == | == See Also == |
Revision as of 16:17, 2 April 2012
Description | template system for Emacs |
---|---|
Author | João Távora |
Maintainer | João Távora |
Source | https://github.com/capitaomorte/yasnippet |
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.
Basic setup
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas/global-mode 1)
Helpful keybindings
- [Tab]
- Expand snippet.
Common Customization
Use Yasnippet with Hippie Expand
If you use Hippie Expand, you can add Yasnippet to the list of expansion functions. For example if you want to try expanding snippets first:
(setq hippie-expand-try-functions-list (cons 'yas/hippie-try-expand hippie-expand-try-functions-list))
You could do this globally, or for a specific mode using a mode hook.
Note: If you use [Tab] for Hippie Expand, consider using a prefix for your snippets. Otherwise you may be trying to tab between possible expansions and find yourself tabbing through fields in an expanded snippet instead.