How do I create a new syntax hilighting set for a language in Sublime text 2

荒凉一梦 提交于 2019-12-07 10:48:45

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/11263568/how-do-i-create-a-new-syntax-hilighting-set-for-a-language-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!