Convert Sublime grammar to Atom grammar

The docs describe how to convert a TextMate Bundle into an Atom package:

I would like to convert this Sublime Text Package for Modelica syntax highlight

into an Atom package.

Automatic conversion using

apm init --package C:\Users\myName\.atom\packages\language-modelica3 --convert

did not work.

Should I convert from Sublime to TextMate first? Any other ideas?

1 Like

Here is a way that worked for me (on Kubuntu 14.10).

Start from any empty directory, then execute step by step:

  1. Get a copy of the TextMate-to-Sublime-Converter script (converts in both directions)
    git clone

  2. Delete the directory Sublime Text from the examples directory
    rm -r textmate-to-sublime-converter/examples/subl2tm/Sublime\ Text/

  3. Get a copy of the Sublime syntax package that you want to convert, in my case
    git clone

  4. Copy the Sublime syntax package to a directory Sublime Text (i.e. same name as the deleted one)
    cp -r modelicaSublimeTextPackage/ textmate-to-sublime-converter/examples/subl2tm/Sublime\ Text/

  5. Change to that directory
    cd textmate-to-sublime-converter/examples/subl2tm/

  6. Call ant
    ant -f build.xml

  7. You now have a TextMate package that can be converted using the Atom Package Manager
    apm init --package ~/.atom/packages/language-modelica3 --convert TextMate/

  8. As a last step, one could share that package (or both the TextMate bundle and the Atom package), but I’ll have to figure that out in the next days


Worked like a charm! Thanks for posting this!

You might also want to try this script of mine, called Atomizr. It converts .sublime-completions and .sublime-snippet files into Atom CSON or JSON. In addition, you can split or merge the resulting files.

If you run into problems, you might have to define replacement filters in the header of the script. This might be necessary for certain escaped characters.

Work in progress!


I have added a “pre-processor” for tmBundles, so you can put TextMate/Sublime Text packages in order before conversion. The TextMate files are still converted with apm (called by atomizr), while Sublime Text files are converted by the script itself.

Try this at home:

# Install
git clone
cd atomizr; chmod +x atomizr

# Grab random TextMate package
git clone CoffeeScript.tmBundle

# Convert, then delete
./atomizr -i CoffeeScript.tmBundle -o lang-coffeescript -X

@idleberg Thanks that worked like a charm! :grinning:


For basic conversion between Sublime Text completions and Atom snippets, I’ve uploaded this package earlier today. There’s also a counter-part for Sublime Text, but it’s not yet on Package Control.

I get some error on step 6 in process, but I ignore it, and done next steps and all worked fine!

Apache Ant™ version 1.9.3 compiled on April 8 2014
Trying the default build file: build.xml
Buildfile: /home/alexzander/convertZIMPL/textmate-to-sublime-converter/examples/subl2tm/build.xml
Detected Java version: 1.8 in: /usr/lib/jvm/java-8-oracle/jre
Detected OS: Linux
parsing buildfile /home/alexzander/convertZIMPL/textmate-to-sublime-converter/examples/subl2tm/build.xml with URI = file:/home/alexzander/convertZIMPL/textmate-to-sublime-converter/examples/subl2tm/build.xml
Project base dir set to: /home/alexzander/convertZIMPL/textmate-to-sublime-converter/examples/subl2tm
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Importing file /home/alexzander/convertZIMPL/textmate-to-sublime-converter/subl2tm.xml from /home/alexzander/convertZIMPL/textmate-to-sublime-converter/examples/subl2tm/build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile /home/alexzander/convertZIMPL/textmate-to-sublime-converter/subl2tm.xml with URI = file:/home/alexzander/convertZIMPL/textmate-to-sublime-converter/subl2tm.xml
[macrodef] creating macro subl2tm
[macrodef] creating macro subl2tm-snippet
Overriding previous definition of reference to ant.projectHelper

Target “build.xml” does not exist in the project “Sublime Text package to Textmate bundle transformer”.

Installing Atomizr just got a little easier:

sudo gem install atomizr

It’s my first Ruby gem, please let me know if you discover any bugs!

Here’s yet another version of Atomizr, this time as a Node package.

I’m not sure whether I’m continuing support for the Ruby gem, but I’m planning to incorporate all its features to the Node package.

1 Like