Search code examples
text-editortextmatetextmatebundlesbundles

How can I change language contexts in Textmate bundles?


I'd like to get my Textmate bundles to use the correct contexts based on what I'm editing. For example I use YUI a lot so I'd like the HTML bundle to use the YUI JS bundle instead of the standard JS one, etc.

Can anyone suggest where and what I should be editing to make that happen. Bonus points for tips on bundle editing.


Solution

  • The thing we are talking about here is scope. You'll have to edit your Bundle elements scope.

    Let's take a look:

    alt text http://mtod.org/so/scope.png

    Now, edit the scope to a wider one, for example use source.js instead of source.js.yui. This should be applied to every snippet, command, etc. in the Bundle. You could probably do a search & replace directly on your Bundle files.

    alt text http://mtod.org/so/edit.png

    That's it. Bundle snippet triggered below.

    alt text http://mtod.org/so/yui.png