Bunch of editor snippets in YASnippet format, shared between my Emacs and Atom setups. I switch between the two quite frequently, and having a SSOT for snippets makes them easier to sync.
These snippets are tailored to my personal workflow, and probably won't be of
much interest to you. However, you might find yas2atom.pl helpful if
you switch between Emacs and Atom on a regular basis. This is a Perl program
that generates the snippets.cson file Atom uses to store custom snippets.
To assemble the .yasnippet files into CSON, run:
$ make cson && mv snippets.cson ~/.atomOr if you'd like to compile snippets from another directory, use:
$ ./yas2atom.pl /path/to/your/*.yasnippet > output.csonEven if you don't use Emacs, you might prefer to store your snippets using
.yasnippet files instead of one huge CSON blob. YAS's format is based
upon TextMate's snippets, just like Atom's. The syntax is essentially the
same (but not 100%; see “Caveats” below)
For syntax highlighting, install the language-emacs-lisp package.
Some things to consider before forking this and adding your own snippets:
-
Selectors must be specified in each file.
This takes the form of an extra header field namedatom-selector:# -*- mode: snippet -*- # key: prefix +# atom-selector: .source.js # --If this field is absent, the snippet will be omitted from the compiled CSON file. This can be helpful if you port snippets from Atom packages, and you don't want pointless duplicates inflating your
snippets.cson. -
Conversion isn't lossless.
YASnippets is much more featureful than Atom's snippet system. No attempts are made to convert or strip syntax it doesn't support (like embedded Lisp expressions).