Automatically Download TextMate Snippets

5 views
Skip to first unread message

Jeff Wheeler

unread,
Mar 22, 2008, 5:33:41 PM3/22/08
to smart-snippet
It seems to me that yasnippet was written with TextMate bundles, so I
went ahead and wrote a quick Python script to download snippets from
any TextMate bundle and save them as yasnippets in a given path.

The source is available here:
http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_copier.py;hb=59de

There's not really any documentation at the moment, but an example
usage should suffice for the moment:

$ mkdir html-mode
$ ./snippet_copier.py --bundle HTML --path html-mode

This will download the snippets from here <http://macromates.com/svn/
Bundles/trunk/Bundles/HTML.tmbundle/Snippets/> and put them in the
folder html-mode.

I created a separate folder outside of yasnippets in ~/.emacs.d/, and
then include both that and the original yasnippets snippets in my
init.el.

Jeff Wheeler

Jeff Wheeler

unread,
Mar 22, 2008, 5:36:28 PM3/22/08
to smart-snippet
Also note that some snippets don't work quite right, especially those
which include specific TM functionality (e.g. TM's selection variable).

Chiyuan Zhang

unread,
Mar 22, 2008, 8:39:22 PM3/22/08
to smart-...@googlegroups.com
Hi! Thanks for sharing this. I've added a link to your script on
the wiki page:
http://code.google.com/p/yasnippet/wiki/UserContributedSnippets

2008/3/23, Jeff Wheeler <jeffw...@gmail.com>:

Jeff Wheeler

unread,
Mar 22, 2008, 9:44:14 PM3/22/08
to smart-snippet
Sweet, thanks!

I just realized that a better direct link to the script would be this,
which will update with new versions:
http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_copier.py

(By the way, it should be "wrote" in the first sentence of the second
paragraph.)

Anyways, thanks a bunch...

Jeff Wheeler

On Mar 22, 7:39 pm, "Chiyuan Zhang" <plus...@gmail.com> wrote:
> Hi! Thanks for sharing this. I've added a link to your script on
> the wiki page:http://code.google.com/p/yasnippet/wiki/UserContributedSnippets
>
> 2008/3/23, Jeff Wheeler <jeffwhee...@gmail.com>:
>
>
>
> > It seems to me that yasnippet was written with TextMate bundles, so I
> > went ahead and wrote a quick Python script to download snippets from
> > any TextMate bundle and save them as yasnippets in a given path.
>
> > The source is available here:
> > http://code.nokrev.com/?p=snippet-copier.git;a=blob_plain;f=snippet_c...

Chiyuan Zhang

unread,
Mar 23, 2008, 7:34:53 AM3/23/08
to smart-...@googlegroups.com
Updated. :)

2008/3/23, Jeff Wheeler <jeffw...@gmail.com>:

gabiruh

unread,
Mar 24, 2008, 10:20:10 PM3/24/08
to smart-snippet
On Mar 22, 6:36 pm, Jeff Wheeler <jeffwhee...@gmail.com> wrote:
> Also note that some snippets don't work quite right, especially those
> which include specific TM functionality (e.g. TM's selection variable).

And snippet's names containing spaces like: "Python Django Template"
has to be passed as "Python%20Django%20Template" in command line, I
think you should encode spaces on uri.



Thanks for this script.

---

Gabriel Andrade

Jeff Wheeler

unread,
Mar 25, 2008, 7:06:53 PM3/25/08
to smart-...@googlegroups.com
Nice catch; I just fixed it. Remember to use quotation marks around the
entire bundle name, though (otherwise optparse won't recognize it as an
option belonging to --bundle).

Jeff Wheeler

travis

unread,
Mar 28, 2008, 5:41:12 PM3/28/08
to smart-snippet
Is it just of does the latest version output wacky results. I did
the .//snippet_copier.py --bundle "HTML" --path html-mode and I got
snippets like control, and left, and things like that and the only one
that worked for me was the mailto snippet. Is this the same things for
anyone else?
Reply all
Reply to author
Forward
0 new messages