How to create a new syntax set for syntax for a language in Sublime text 2

I use the awesome Sublime Text 2 to write Maya Embedded Language (MEL) scripts for Maya, but it does not have syntax highlighting for MEL. Now I am forcing him to interpret the text as Perl, which does the job of OK, but its far from ideal. It would be convenient to add Maya commands. Does anyone know how I will create syntax highlighting for Sublime?

+4
source share
2 answers

I am using the MEL texting set that I found on github. I forked it, added some fragments and changed the language a bit. The language file was MEL.plist, but I changed it to MEL.tmLanguage, and now it works in Sublime Text 2. All fragments work unchanged.

If you want to use it, go to the Sublime Text Packages directory and clone the repo on MEL:

git clone git@bitbucket.org :hoolymama/mel.tmbundle.git MEL 
+5
source

I think it's best to read the docs on how to write a syntax definition . its json format, which defines all patterns for capture and their presentation.

You can use an existing .tmLanguage file as a guide, for example (on OSX): ~/Library/Application Support/Sublime Text 2/Packages/Perl/Perl.tmLanguage

In short, you create a new package, such as "MEL", and place the MEL.tmLanguage file MEL.tmLanguage .

+4
source

All Articles