[TextMate] Feature - managing the snippets

profprof at mac.com profprof at mac.com
Thu Oct 14 20:59:27 UTC 2004


 
On Thursday, October 14, 2004, at 04:45PM, Jan Sabbe <jan.sabbe at student.kuleuven.ac.be> wrote:

>
>Op 14-okt-04 om 21:44 heeft Allan Odgaard het volgende geschreven:
>
>> On 14. Oct 2004, at 21:21, profprof at mac.com wrote:
>>
>>> It would be most useful if the snippets were only active when their 
>>> respective mode is active. This way, the same trigger could be used 
>>> for various modes and applications.
>>
>> The problem with this is that you wouldn't be able to have general 
>> snippets, and it would require you to set a "belongs to" for each 
>> snippet.
>>
>> I'm not completely rejecting the idea (since I definitely do not think 
>> the current solution is ideal).
>>
>> What I would however propose is, that when multiple snippets match, it 
>> will use the snippet from the same bundle as the current syntax rules 
>> -- if there is none, a menu will show.
>>
>> This should allow for general snippets, and in most cases will solve 
>> the ambiguity.
>>
>> There's still one problem though, for example we have a HTML bundle 
>> which may contain some HTML snippets, but the PHP bundle has a _new_ 
>> HTML syntax file, so HTML (PHP) would _not_ treat snippets from the 
>> HTML bundle with higher priority than any other snippets.
>>
>> Though this would probably be solved when I do style sheets, since the 
>> PHP bundle would then not define the HTML syntax (again), but only 
>> create a new style sheet for the existing HTML syntax.
>>
>> How does that sound?
>>

This sounds like an elegant solution. It would give much more flexibility to the system. As was suggested by somebody on the Wiki page, this could be combined with a classification.

So, if in Latex, I want to generate a table, I type:

      table[tab]

If I wanted to include an HTML snippet in Latex mode, then I might type:

     html:table[tab]

If the command is not found in Latex, and only in another mode, then it is found without having to specify the type.

Normand Mousseau






More information about the textmate mailing list