sponsor Vim development Vim logo Vim Book Ad

snare : Snippets Again, with Regular Expressions

 script karma  Rating 1/1, Downloaded by 684  Comments, bugs, improvements  Vim wiki

created by
Paul Isambert
 
script type
utility
 
description
This plugin expands code snippets for which the trigger is a regular
expression; submatches can be reused in the expansion. Along with command
substitution, regular expressions allow the user to define flexible snippets.

A few examples:

- In HTML, expand "<mytag" to
    <mytag>$$</mytag>
(with $$ marking the next position of the cursor), no matter what
"mytag" is.

- In Ruby, expand "do" to
    do
      $$
    end
and "do a b c" to
    do |a, b, c|
      $$
    end
with a single pattern.

- In JavaScript, expand "var a b c" to
    var a = $$,
        b = $$,
        c = $$;

- Etc.

The plugin follows a minimalist design, trying to be a simple yet powerful
tool, using Vim's native resources (vim script, search patterns), and avoiding
fancy features.
 
install details
See the "Quick start" section of the help file.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
snare.zip 1.0 2014-04-17 7.0 Paul Isambert Initial upload
ip used for rating: 18.97.14.85

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.
   
Vim at Github