A ruby tool to convert textmate snippet bundles to yasnippet format.
These rails-centric conversions already bundled:
Make sure you cloned
yasmate with the
--recursive option to fetch
submodules of the actual "tmbundles" maintained by the Textmate
yasmate's top dir:
gem install plist trollop # two dependencies needed first rake convert_bundles # will convert ruby, rails and html bundles
Then, in your
(add-to-list 'load-path "/path/to/yasnippet") (require 'yasnippet) ;; use just the yasmate snippet collection (setq yas-snippet-dirs '("~/.emacs.d/snippets" "/path/to/yasmate/snippets")) (yas-global-mode 1)
Open some rails file (model, app, etc) and start using the textmate snippets.
How to convert foo.tmbundle
Add a git submodule
bundles/foo.tmbundlepointing to the
foo-modeis the corresponding emacs major-mode.
yasmate.rb -d bundles/foo.tmbundle -o snippets/foo-mode
That's it, your converted snippets now live under
It messed up on snippet XYZ!!!
Yep, it's unlikely be perfect.
yasmate.rb has some rules for translating bits of Textmate syntax to
yasnippet's embedded elisp syntax. I call these substitutions. For
example, this is Textmate
is this in yasnippet
Those builtin rules help a lot, but some textmate bundles have very specific substitutions that have to be added into the mix in a per-bundle fashion.
So there are these
files that help with that.
Here's how it works:
you follow the steps I gave above
you notice that
yasmate.rbalso created a
snippets/foo-mode/.yasmate-unknown-substitutions.elfile. You notice the unknown substitution for the snippet XYZ that didn't work
you grab that bit, correct it, and paste it into a new
The format of the substitution files sucks
Yep! It's very ... inventive. And wrong. They should be pure elisp
yasmate.rb should be rewritten in emacs-lisp to spare the
dependency on ruby.