/UltiSnips

The ultimate snippet solution for python enabled Vim.

Primary LanguagePython

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2715

UltiSnips is the Ultimate solution for snippets under Vim. Snippets are intelligent texts that spare you a lot of typing. Like many snippets solutions, this one ins heavily inspired by TextMates Snippet Syntax and offers all features that TextMate offers plus some more. But in Vim.

UltiSnips has the following features (incomplete list):

- TextMates snippet syntax
- Tabstops, Placeholders (also nested)
- Mirrors and Transformations (also inside Placeholders)
- ShellCode, VimCode and a very powerful PythonCode interpolation
- Live update as you type
- snippets for file types and snippets that are always defined
- same name, multiple snippets
- recursive snippets: snippet in snippet
- forward and backward jumping to placeholders and tab stops
- convert script to download and convert TM bundles, convert script to reuse snipmates snippets.
- automatically reload snippet definition files when they changed.
- extend existing snippet definitions. For example cpp extends c, so that all c snippets are also available in cpp.
- options for snippets: expand only at the beginning of line, inword, convert tabs-to-spaces....
- multi word or regular expression triggers are supported and awesome!
- support for anonymous triggers that other scripts can define on the fly e.g. for automatic completion of parameters of your own functions.
- > 325 unit tests to guarantee that stuff works.
- Tested on Linux, Mac OS X and Windows.

There have been many attempts to do things right; I think, this one nails it.

UltiSnips is a community project, more than 15 people have contributed to it so far. Join in by providing feedback, snippets or code!

Try it:
Example 1:
- open /tmp/file.c
type for<tab>endcounter<c-j>mycounter<c-j><c-j>int a = 3;
yields:
------------------- SNIP -------------------
for(size_t mycounter = 0; mycounter < endcounter; ++mycounter)
{
	int a = 3;
}
------------------- SNAP -------------------

Example 2:
- open /tmp/blah.help
- :set ft=help
- type sec<tab>MY COOL SECTION<c-h>blah
yields:
------------------- SNIP -------------------
=============================================================================
MY COOL SECTION                                        *blah-my-cool-section*

blah
------------------- SNAP -------------------


If you like the script, please contact me and vote for the script!