views:

32

answers:

2

I just installed the Python Django and Django Templates bundles in Textmate. However, the tag triggers dont seem to work. I opened up a .py file and wrote manytomany and pressed tab and it didnt autocomplete.

When i click on it manually from the menu bar it works fine. Am I forgetting something? Do bundles need to be activated somehow?

A: 

Are you sure the shorthand is manytomany? in my bundle, it's mtm. Try editing the bundle to see what the shorthadn trigger strings are.

stevejalim
+1  A: 

You might have a scope mismatch--i.e., the scope you're in when you invoke that snippet has to match the scope(s) in which it was defined.

In your case, the default scope selector for the 'many-to-many' snippet is source.python.django, yet the scope you were probably in at the time you invoked the snippet was source.python, which is the pre-set scope when you open/create a python file.

There's two ways to deal with this, both are easy. The first is to change the document's scope; the second is to change the function/snippet's scope.

To do the first, just change the language associated with the document you are in via the pop-up menu in second panel (from the left) of the control bar (at the very bottom of the TM document window). When you open a python (.py) document, it should be set to "Python" by default. Click the triangles just to the right of "Python" and select "Python Django". Once you've done that, then typing "manytomany" in the text area then hitting TAB, will do what you want.

Alternatively you can change the snippet's scope. To do this, open the Bundle Editor ("ctrl-option-cmd B"), then select "Python Django" then the "ManytoMany" snippet. Click the "settings" button at the upper right of the Bundle Editor window, then change the text in the Scope Selector text box to read "source python" (by default it should read "source.python.django").

doug
Thanks a lot. Does changing the scope apply to all documents in a project or do i have to do it for each one manually.
Ali
No problem. It seems that a change in language (at least when done via the control bar) while in one document, changes the language for *all* files in your project (at least for those which has the same language as the document you are in)--this is the *default behavior* apparently.
doug