Auto-Yasnippets

I stumbled across the package Auto-YASnippet, by the prodigious
abo-abo, again the other day. I vaguely remember reading about it a
couple of years ago when it was first released. The idea is to create
a temporary yasnippet on the fly without leaving your current buffer.
That can be really useful when you want to create a series of nearly
identical entries in a program that differ only in a term or two.
Abo-abo describes it as a hybrid of keyboard macros and yasnippet.

You can do the same sort of thing with keyboard macros if you can
remember how to invoke the recursive editing features. Abo-abo’s
solution is much easier: you just write the body of your text, marking
the fields that will change by a ~. Then you can create as many
additional instances as you like, substituting different values for
the marked field(s). Take a look at the README for some examples of
how it works.

I’m not sure why this didn’t register with me more when I first saw
it. It’s probably because I don’t program in languages like Java or
JavaScript where a tool like Auto-YASnippet makes more sense and can
save some time. If you find yourself regularly writing nearly
identical definitions or other boiler plate, take a look at
Auto-YASnippet; it may save you some time.

Postscript: I had originally planned to publish this yesterday but
serendipitously Mike Zamansky scooped me by posting a video
demonstrating Auto-YASnippet in action. As I wrote then, that was
indeed fortunate because now you can see the package in action. If you
haven’t already, be sure to watch the video.

This entry was posted in General and tagged . Bookmark the permalink.