I'm using the amazing Sublime Text 2 to write MEL (Maya Embedded Language) scripts for Maya, but it has no syntax highlighting for MEL. Right now I force it to interpret the text as Perl, which does an OK job, but its far from perfect. It would be handy to add Maya's commands. Does anybody know how I would create a syntax highlighting set for Sublime?
2 Answers
I have been using a MEL textmate bundle I found on github. I forked it, added some snippets and tweaked the language a little. The language file was MEL.plist but I changed it to MEL.tmLanguage and it now works in Sublime Text 2. All the snippets work with no change.
If you want to use it, go to your Sublime Text Packages directory and clone the repo to MEL:
git clone git@bitbucket.org:hoolymama/mel.tmbundle.git MEL

- 6,256
- 5
- 31
- 43
-
1I just updated the repo. It now contains a sublimeText plugin that sends selected mel to maya. It appears in the right mouse menu. – Julian Mann Jul 03 '12 at 11:59
-
2Useful, but does not answer the question about how to create syntax for a new language. jdi's answer below is much better... – JPuge Oct 22 '12 at 20:41
-
@JPuge Well it helped the questioner, and jdi below also found it useful in his maya sublime plugin. So thanks for the downvote, I bet that really made your day complete. – Julian Mann Oct 23 '12 at 02:19
-
1@JulianMann It will not help anyone searching for "How do I create a new syntax hilighting set for a language in Sublime text 2" or something similar. – JPuge Oct 23 '12 at 06:45
-
1Or maybe the question's title should be modified because it does not really represent what the poster actually needed. – Loomchild Jul 10 '14 at 13:32
I think your best bet is to read the docs about how to write a syntax definition. its a json format that defines all the patterns to capture and how to represent them.
You can use an existing .tmLanguage
file as a guide, such as (on OSX):
~/Library/Application Support/Sublime Text 2/Packages/Perl/Perl.tmLanguage
In a nutshell, you create a new package like "MEL", and put the MEL.tmLanguage
file in there.

- 90,542
- 19
- 167
- 203
-
I just created the start of a text plugin for sending python code snippets from Sublime -> Maya: https://github.com/justinfx/MayaSublime . If you end up creating a MEL syntax file, you could add it to this project if you want. – jdi Jul 03 '12 at 02:32
-
As an update, my plugin is now part of the Package Manager and includes Mel highlighting – jdi Sep 28 '13 at 21:14