snippetsEmu - An attempt to emulate TextMate's snippet expansion : vim online
Keywords: Vim, Vi IMproved, text editor, home, documentation, tips, scripts, news

snippetsEmu : An attempt to emulate TextMate's snippet expansion
script karma | Rating 2429/696, Downloaded by 34171 | Comments, bugs, improvements | Vim wiki
created by
Felix Ingram
script type
utility
description
***** IMPORTANT ***** The plugin has now been split into two separate vimballs. The plugin itself and the bundles. This was done because bundles were updated a lot more often than the plugin itself. Previous users of the plugin should delete the old file when upgrading to 1.0. The name of the file changed in 0.6 and so you'll end up with two versions when unpacking the file. Remove the old version "snippetEmu.vim" from the plugin directory. The new version is called "snippetsEmu.vim". Note the extra 's' Homepage: http://slipperysnippets.blogspot.com/ Issue tracker: http://code.google.com/p/snippetsemu/issues/list Please email me bugs or create them in the issue tracker. This file contains some simple functions that attempt to emulate some of the behaviour of 'Snippets' from the OS X editor TextMate, in particular the variable bouncing and replacement behaviour. DIVING IN: Install the plugin, start a new perl file (as an example) and type the following in insert mode: for<tab><tab><tab><tab> You'll see the text expand and the jumping in action. Try the same again but this time type a new value for 'var' once it is selected. I.e. for<tab>test<tab><tab><tab> Notice how all the 'var's are replaced with 'test'. Check out the bundles and the docs for more examples of what can be done. *IMPORTANT* If you have any questions, suggestions, problems or criticisms about the plugin then please, please email me and I will do the best to help.
install details
Firstly create an 'after/ftplugin' directory in your vim home (e.g. ~/.vim/after/ftplugin under unix or vimfiles/after/ftplugin under Windows). This is required as Vimball sometimes does not create it for some reason. Download the plugin vimball (and the bundle vimball if you would like the default snippets). Now open the Vimball(s) with Vim and follow the instructions (source the vimball to install everything). Vimball should create the help tags. Do a :helptags on your doc directory if it hasn't. Enjoy
script versions (upload new version) Click on the package to download.
package | script version | date | Vim version | user | release notes
--- | --- | --- | --- | --- | ---
snippy_plugin.vba | 1.2.3 | 2008-03-13 | 7.0 | Felix Ingram | Fixed jumping bug which caused problems with tags between two named tags being missed out. (really, really uploaded new version)
snippy_bundles.vba | 1.2 | 2008-03-13 | 7.0 | Felix Ingram | Small fix to php bundle. 'php' trigger is now 'phpp'. Previous version could too easily cause conflicts when using the 'incl' snippet.
snippy_bundles.vba | 1.1 | 2008-03-03 | 7.0 | Felix Ingram | Updates to the C and HTML bundles
snippy_bundles.vba | 1.0 | 2008-02-25 | 7.0 | Felix Ingram | Filetype plugins for snippetsEmu
snippy_plugin.vba | 1.2.2 | 2008-02-25 | 7.0 | Felix Ingram | Bug fix to plugin. Annoying window jumping sorted out. Bundles are now in a separate vimball.
snippetsemu1.2.1.vba | 1.2.1 | 2007-09-30 | 7.0 | Felix Ingram | VBA file now has unix fileformat, so things should be working better. Vimball has also added fold markers, which aren't backwards compatible, so I've removed them as well.
snippetsemu1.2.vba | 1.2 | 2007-09-30 | 7.0 | Felix Ingram | Finally released new version. Big change: No more messing with iskeyword. Other stuff - Commands with autocomplete, new commands for creating snippets, updated bundles. Be sure to read the docs to see what's available.
snippetsemu1_1.vba | 1.1 | 2007-04-05 | 7.0 | Felix Ingram | New version contains several bug fixes, reverts start and end tags to more 'friendly' settings and tries to address indenting issues. Snippets must now define their own 'local' indenting. Make sure you create the after/ftplugin directories as described in the installation instructions.
SnippetsEmu_1.0.1.vba | 1.0.1 | 2006-12-29 | 7.0 | Felix Ingram | Even more super 1.0.1 version with Unix line endings on the Vimball so things install properly on *nix.
SnippetsEmu_1.0.vba | 1.0 | 2006-12-28 | 7.0 | Felix Ingram | Super new 1.0 version with many new features and improvements. New bundles also included.
snippetsEmu0.6.1.vba | 0.6.1 | 2006-11-28 | 7.0 | Felix Ingram | Quick fix changes the line endings for the VBA to UNIX which should hopefully stop some problems people are having
snippetsEmu0.6.vba | 0.6 | 2006-11-25 | 7.0 | Felix Ingram | Bugs fixes as per usual but this new version includes a set of snippets bundles for use with various filetypes. Plugin is now a VimBall so everything is in one file.
snippetEmu0.5.6.vim | 0.5.6 | 2006-08-29 | 7.0 | Felix Ingram | Fixed several bugs from the last version including random bug which prevented snippets from starting with 's'.
snippetEmu0.5.5.vim | 0.5.5 | 2006-08-14 | 7.0 | Felix Ingram | Fixed various bugs: s:search_str not being defined or being buffer specific and command tag execution not working with two tags on the same line.
snippetEmu0.5.4.vim | 0.5.4 | 2006-07-25 | 7.0 | Felix Ingram | TextMate compatibile mode now works under linux.
snippetEmu0.5.3.vim | 0.5.3 | 2006-07-12 | 7.0 | Felix Ingram | Bug fixes. Things are a lot better behaved. Edge cases should (should) work a lot better now. Highly recommended upgrade.
snippetEmu0.5.2.vim | 0.5.2 | 2006-07-04 | 7.0 | Felix Ingram | Minor bug fix. Textmate compatible mode did not allow quotes in expansions. Fixed
snippetEmu0.5.1.vim | 0.5.1 | 2006-07-03 | 7.0 | Felix Ingram | This new version adds some bug fixes to the last release and adds the new functionality of being able to define multicharacter start and end tags. It is now easier to define tags which work across multiple languages.
snippetEmu0.5.0.vim | 0.5.0 | 2006-07-01 | 7.0 | Felix Ingram | This new version adds TextMate style expansions: snippets are not expanded automatically. The user must press Tab for a snippet to be expanded. Tabbing will jump between tags or insert a <Tab> if no tags are active. The tag syntax has changed. Default values are not supported anymore: use the tag's name instead. Commands can now be added in the first tag and unnamed tags can include commands. This is a test release: please send bug reports.
snippetEmu.vim | 0.3.6 | 2006-01-16 | 6.0 | Felix Ingram | Minor bug fix. Replacement values modified by commands would be passed to future commands in their modified form, rather than with the original replacement value.
snippetEmu.vim | 0.3.5 | 2006-01-14 | 6.0 | Felix Ingram | Fundamental change to the way the new commands feature works. The command is now 'executed' and the result placed in the variable @z. The intention is for the command to be a function call rather than a standard command. I.e. using substitute() rather than :s///. The value to be replaced is available to the function in @z (previous values of the variable are kept and restored once the command has been executed). See the updated docs for examples.
snippetEmu.vim | 0.3.1 | 2006-01-12 | 6.0 | Felix Ingram | Bug fix - Non-greedy matching is now done on the command searching.
snippetEmu.vim | 0.3 | 2006-01-11 | 6.0 | Felix Ingram | New version allows commands to be included in named tags. Experimental version - does not appear to break older functionality, however.
snippetEmu.vim | 0.2.5 | 2006-01-05 | 6.0 | Felix Ingram | Tag delimiters can now be set with autocommands to allow for different filetypes. I.e. '<' and '>' for programming and '@' for HTML.
snippetEmu.vim | 0.2.4 | 2006-01-05 | 6.0 | Felix Ingram | Fixed a bug where certain tags were not recognised
snippetEmu.vim | 0.2.3 | 2006-01-04 | 6.0 | Felix Ingram | Now works with autoindenting
snippetEmu.vim | 0.2.2 | 2005-08-09 | 6.0 | Felix Ingram | Better behaved. Couple of bug fixes.
snippetEmu.vim | 0.2.1 | 2005-08-09 | 6.0 | Felix Ingram | Added check for the default key combo so that the user's settings aren't clobbered.
snippetEmu.vim | 0.2 | 2005-08-08 | 6.0 | Felix Ingram | I've given this a full point release as it's a major rewrite. Start and end tags can now be defined and default values can also be used.
snippetEmu.vim | 0.1 | 2005-07-26 | 6.0 | Felix Ingram | Initial upload

| If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly. Questions about Vim should go to the maillist. Help Bram help Uganda. |  |